Marine systems simulation
CoRiBoDynamics::ConjugateGradientSolver Class Reference

#include <ConjugateGradient.h>

+ Collaboration diagram for CoRiBoDynamics::ConjugateGradientSolver:

Classes

class  VectorTask
 

Public Member Functions

 ConjugateGradientSolver (LinearOperator *A)
 
void SetThreadPool (CoreBoundThreadPool *ThreadPool)
 
void solve (const Vector &B, Vector &X, double &tolerance, int &iterations)
 
void ParallellizeVectorOperations (bool b)
 

Protected Member Functions

double CG_squared_norm (const Vector &a)
 
void CG_flip_and_add (const Vector &a, Vector &b)
 
void CG_scale_and_add (const Vector &a, double beta, Vector &b)
 
double MultiOP (Vector &p, Vector &tmp, double alpha, Vector &x, Vector &r)
 

Protected Attributes

LinearOperatorm_A
 
Vector m_residual
 
Vector m_p
 
Vector m_z
 
Vector m_tmp
 
CoreBoundThreadPoolm_ThreadPool
 
bool m_parallelize_vector_operations
 
std::vector< VectorTaskm_vector_task
 

Detailed Description

Solves for the linear equation A*X=B, for a given tolerance. Main purpose is to keep working memory persistent to minimize allocation overhead, and manage parallellism of vector operations

Interface for an general linear (matrix) operation. Important functions are to apply the linear operator to a vector, and to compute an approximation of the operator inverse.

Member Function Documentation

◆ solve()

void CoRiBoDynamics::ConjugateGradientSolver::solve ( const Vector &  B,
Vector &  X,
double &  tolerance,
int &  iterations 
)

Solves for the linear equation A*X=B, for a given 'tolerance'. Uses the given X as starting iteration value; 'iterations' specifies max iteration number, and will be set to actual iteration count


The documentation for this class was generated from the following file: