Function IterativeSolver::ConjugateGradient(AMatrix *, puma::Matrix<double> *, double, int, bool, int)
Defined in File iterativesolvers.h
Function Documentation
-
bool IterativeSolver::ConjugateGradient(AMatrix *A, puma::Matrix<double> *x, double tol, int maxIt, bool print, int numThreads)
solves a homogeneous (right-hand side equals zero) linear system of equations using the conjugate gradient method.
- Parameters
A – a pointer to an AMatrix representing the linear system being solved.
x – a pointer to a puma matrix which stores the solution. The matrix should contain an initial guess for the solution when passed in.
tol – a double specifying the convergence criterion.
maxIt – an integer specifying the maximum number of iterations the solver may execute before exiting.
print – a boolean which specifies whether the the number of iterations and residual are printed after each iteration of the solver.
- Returns
a boolean indicating whether or not convergence was achieved.