Bachelor's degree final project  v1.0
Faculty of Mathematics, University of Barcelona
Defines | Functions
src/newton.c File Reference

Implements the functions for a Newton's method. More...

#include "newton.h"
+ Include dependency graph for newton.c:

Defines

#define _DEFAULT_NEWTON_MAX_ITERATIONS   10
 Maximum number of newton iterations.

Functions

unsigned int get_newton_max_iterations ()
 Get the maximum number of newton iterations.
unsigned int set_newton_max_iterations (unsigned int newton_max_iter)
 Set the maximum number of newton iterations.
double * malloc_vector2 (size_t n)
int newton (size_t m, size_t n, double *const x, double *const f, double **const df, void *(*solve)(size_t, size_t, double **const, double *const, double *const, double), double tol)
 Implements the compute of a newton method's iteration.
void newton_differential_block (size_t m, size_t n, double *const x, double *const f, double **const df, double w, double t)
 Compute a block of the differential for the Newton's method.
void dft_r2r_1d (size_t n, size_t N, double *const dft, double *const x, double theta)
 Compute the Discrete Fourier Transform.
void newton_differential (size_t n, size_t N, double *const x, double *const X, double **const DF, void(*f)(size_t, size_t, double *const, double *const, double **const, double, double), double w, double *h)
 Compute the differential for the Newton's method.
void * newton_execute (size_t n, size_t N, double *const x, double *const X, double **const DF, double w, double tol, void(*f)(size_t, size_t, double *const, double *const, double **const, double, double), void *(*solve)(size_t, size_t, double **const, double *const, double *const, double), short unsigned int autonomous)
 Implement the execution of a Newton's method.

Detailed Description

Implements the functions for a Newton's method.

Author:
Joan Gimeno
Date:
22/01/2014 (start)
Version:
1.0

Define Documentation

Maximum number of newton iterations.


Function Documentation

void dft_r2r_1d ( size_t  n,
size_t  N,
double *const  dft,
double *const  x,
double  theta 
)

Compute the Discrete Fourier Transform.

Parameters:
[in]nSpace's dimension
[in]NMesh size
[out]xDiscrete Fourier Transform
[in]XFourier coefficients
[in]thetaAngle evaluation

+ Here is the caller graph for this function:

unsigned int get_newton_max_iterations ( )

Get the maximum number of newton iterations.

Returns:
Maximum number iterations for Newton's method
double* malloc_vector2 ( size_t  n)
int newton ( size_t  m,
size_t  n,
double *const  x,
double *const  f,
double **const  df,
void *(*)(size_t, size_t, double **const, double *const, double *const, double)  solve,
double  tol 
)

Implements the compute of a newton method's iteration.

Parameters:
[in]mRows of the matrix
[in]nColumns of the matrix
[in]xCurrent iteration value
[out]xNext iteration value
[in]fConstant terms
[in]dfMatrix of the linear system
[in]*solvePointer to solver linear systems of equations
[in]tolTolerance
Return values:
0Some problem has ocurred
1When the solution x is accepted by the tolerance given

References solve().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void newton_differential ( size_t  n,
size_t  N,
double *const  x,
double *const  X,
double **const  DF,
void(*)(size_t, size_t, double *const, double *const, double **const, double, double)  f,
double  w,
double *  h 
)

Compute the differential for the Newton's method.

Parameters:
[in]nSpace's dimension
[in]NMesh size
[in,out]xDiscrete Fourier Transform for each mesh's element, that is, n(2N+1) components
[in]XFourier coefficients
[in]DFMatrix of the linear system
[in]fPointer to function given by the user
[in]wParameter
[in]hAuxiliar vector
Returns:
Number of iterations have been performed or NULL if some problem has ocurred

References dft_r2r_1d(), malloc_vector(), and newton_differential_block().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void newton_differential_block ( size_t  m,
size_t  n,
double *const  x,
double *const  f,
double **const  df,
double  w,
double  t 
)

Compute a block of the differential for the Newton's method.

Parameters:
[in]mRows
[in]nColumns
[in]x
[in]f
[out]f
[out]dfBlock matrix of the differential for the Newton's method
[in]wParameter
[in]tAngle of evaulation
Precondition:
The pointers x and f are not NULL
Note:
If df is NULL, the differential will not be compute

+ Here is the caller graph for this function:

void* newton_execute ( size_t  n,
size_t  N,
double *const  x,
double *const  X,
double **const  DF,
double  w,
double  tol,
void(*)(size_t, size_t, double *const, double *const, double **const, double, double)  f,
void *(*)(size_t, size_t, double **const, double *const, double *const, double)  solve,
short unsigned int  autonomous 
)

Implement the execution of a Newton's method.

Parameters:
[in]nSpace's dimension
[in]NMesh size
[in,out]xDiscrete Fourier Transform for each mesh's element, that is, n(2N+1) components
[in]XFourier coefficients
[in]DFMatrix of the linear system
[in]wParameter
[in]tolTolerance
[in]fPointer to function given by the user
[in]solvePointer to solver linear systems of equations
Returns:
Number of iterations have been performed or NULL if some problem has ocurred
See also:
newton_max_iterations

References newton(), newton_differential(), and solve().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned int set_newton_max_iterations ( unsigned int  newton_max_iter)

Set the maximum number of newton iterations.

Parameters:
[in]newton_max_iterNew value
Returns:
The old maximum number iterations for Newton's method