#include <CG_solver.h>
Public Member Functions | |
CG_solver () | |
~CG_solver () | |
int | init (int N, scalar tol, int max_num_iterations) |
int | solve (SparseMatrixFixedPattern *A, scalar *x, scalar *b) |
int | solve (SparseMatrixFixedPattern *A, scalar *x, scalar *b, int num_iterations) |
Private Member Functions | |
scalar | conjugate_gradient_residual (SparseMatrixFixedPattern *A, scalar *x, scalar *b) |
scalar | residual2 () |
void | parallel_vector_add_self (scalar *v1, scalar a, scalar *v2) |
void | parallel_vector_add (scalar *v1, scalar a, scalar *v2) |
scalar | parallel_apply_preconditioner () |
void | zero (scalar *v) |
scalar | dot (scalar *a, scalar *b) |
Private Attributes | |
int | N |
The number of unknowns. More... | |
scalar | tol |
The convergence tolerance threshold. More... | |
int | max_num_iterations |
Maximum number of iterations before giving up. More... | |
scalar * | inv_M |
The preconditioner matrix (inverse of the diagonal) More... | |
scalar * | d |
Vector needed for use by conjugate gradient solver. More... | |
scalar * | r |
Vector needed for use by conjugate gradient solver. More... | |
scalar * | q |
Vector needed for use by conjugate gradient solver. More... | |
scalar * | s |
Vector needed for use by conjugate gradient solver. More... | |
CG_solver::CG_solver | ( | ) |
CG_solver::~CG_solver | ( | ) |
|
private |
Referenced by solve().
Returns the dot product of vectors a and b, of length N
Referenced by solve().
int CG_solver::init | ( | int | N, |
scalar | tol, | ||
int | max_num_iterations | ||
) |
Referenced by Blob::init().
Referenced by solve().
Referenced by solve().
int CG_solver::solve | ( | SparseMatrixFixedPattern * | A, |
scalar * | x, | ||
scalar * | b | ||
) |
Referenced by Blob::solve_poisson().
int CG_solver::solve | ( | SparseMatrixFixedPattern * | A, |
scalar * | x, | ||
scalar * | b, | ||
int | num_iterations | ||
) |
|
private |
Vector needed for use by conjugate gradient solver.
Referenced by CG_solver(), conjugate_gradient_residual(), init(), solve(), and ~CG_solver().
|
private |
The preconditioner matrix (inverse of the diagonal)
Referenced by CG_solver(), conjugate_gradient_residual(), init(), parallel_apply_preconditioner(), solve(), and ~CG_solver().
|
private |
Maximum number of iterations before giving up.
Referenced by CG_solver(), init(), solve(), and ~CG_solver().
|
private |
The number of unknowns.
Referenced by CG_solver(), conjugate_gradient_residual(), dot(), init(), parallel_apply_preconditioner(), parallel_vector_add(), parallel_vector_add_self(), residual2(), zero(), and ~CG_solver().
|
private |
Vector needed for use by conjugate gradient solver.
Referenced by CG_solver(), init(), solve(), and ~CG_solver().
|
private |
Vector needed for use by conjugate gradient solver.
Referenced by CG_solver(), conjugate_gradient_residual(), init(), parallel_apply_preconditioner(), residual2(), solve(), and ~CG_solver().
|
private |
Vector needed for use by conjugate gradient solver.
Referenced by CG_solver(), init(), parallel_apply_preconditioner(), solve(), and ~CG_solver().
|
private |
The convergence tolerance threshold.
Referenced by CG_solver(), init(), solve(), and ~CG_solver().