![]() |
Bachelor's degree final project
v1.0
Faculty of Mathematics, University of Barcelona
|
Implements the functions for a Newton's method. More...
#include "newton.h"
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. |
Implements the functions for a Newton's method.
#define _DEFAULT_NEWTON_MAX_ITERATIONS 10 |
Maximum number of newton iterations.
void dft_r2r_1d | ( | size_t | n, |
size_t | N, | ||
double *const | dft, | ||
double *const | x, | ||
double | theta | ||
) |
Compute the Discrete Fourier Transform.
[in] | n | Space's dimension |
[in] | N | Mesh size |
[out] | x | Discrete Fourier Transform |
[in] | X | Fourier coefficients |
[in] | theta | Angle evaluation |
unsigned int get_newton_max_iterations | ( | ) |
Get 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 *(*)(size_t, size_t, double **const, double *const, double *const, double) | solve, | ||
double | tol | ||
) |
Implements the compute of a newton method's iteration.
[in] | m | Rows of the matrix |
[in] | n | Columns of the matrix |
[in] | x | Current iteration value |
[out] | x | Next iteration value |
[in] | f | Constant terms |
[in] | df | Matrix of the linear system |
[in] | *solve | Pointer to solver linear systems of equations |
[in] | tol | Tolerance |
0 | Some problem has ocurred |
1 | When the solution x is accepted by the tolerance given |
References solve().
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.
[in] | n | Space's dimension |
[in] | N | Mesh size |
[in,out] | x | Discrete Fourier Transform for each mesh's element, that is, n(2N+1) components |
[in] | X | Fourier coefficients |
[in] | DF | Matrix of the linear system |
[in] | f | Pointer to function given by the user |
[in] | w | Parameter |
[in] | h | Auxiliar vector |
References dft_r2r_1d(), malloc_vector(), and newton_differential_block().
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.
[in] | m | Rows |
[in] | n | Columns |
[in] | x | |
[in] | f | |
[out] | f | |
[out] | df | Block matrix of the differential for the Newton's method |
[in] | w | Parameter |
[in] | t | Angle of evaulation |
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.
[in] | n | Space's dimension |
[in] | N | Mesh size |
[in,out] | x | Discrete Fourier Transform for each mesh's element, that is, n(2N+1) components |
[in] | X | Fourier coefficients |
[in] | DF | Matrix of the linear system |
[in] | w | Parameter |
[in] | tol | Tolerance |
[in] | f | Pointer to function given by the user |
[in] | solve | Pointer to solver linear systems of equations |
References newton(), newton_differential(), and solve().
unsigned int set_newton_max_iterations | ( | unsigned int | newton_max_iter | ) |
Set the maximum number of newton iterations.
[in] | newton_max_iter | New value |