SurgSim::Math::LinearSparseSolveAndInverseCG Class Reference

Derivation for sparse CG solver. More...

`#include <SurgSim/Math/LinearSparseSolveAndInverse.h>`

Inheritance diagram for SurgSim::Math::LinearSparseSolveAndInverseCG:

## Public Member Functions

void | setTolerance (double tolerance)
| Set the conjugate gradient convergence tolerance. More...
double | getTolerance ()
| Get the conjugate gradient convergence tolerance. More...
void | setMaxIterations (SparseMatrix::Index iterations)
| Set the maximum number of iterations for conjugate gradient. More...
SparseMatrix::Index | getMaxIterations ()
| Get the conjugate gradient maximum iterations. More...
void | setMatrix (const SparseMatrix &matrix) override
| Set the linear solver matrix. More...
Matrix | solve (const Matrix &b) const override
| Solve the linear system (matrix.x=b) using the matrix provided by the latest setMatrix call for all columns of the rhs matrix b. More...
Public Member Functions inherited from SurgSim::Math::LinearSparseSolveAndInverse
virtual | ~LinearSparseSolveAndInverse ()
virtual Matrix | getInverse () const

## Private Attributes

Eigen::ConjugateGradient< SparseMatrix > | m_solver

## Additional Inherited Members

Protected Attributes inherited from SurgSim::Math::LinearSparseSolveAndInverse
SparseMatrix | m_matrix
| A copy of the system matrix for use when an inverse is necessary. More...

## Detailed Description

Derivation for sparse CG solver.

## Member Function Documentation

## getMaxIterations()

SparseMatrix::Index SurgSim::Math::LinearSparseSolveAndInverseCG::getMaxIterations | ( |  | ) |

Get the conjugate gradient maximum iterations.

Returns
  the maximum number of iterations allowed

## getTolerance()

double SurgSim::Math::LinearSparseSolveAndInverseCG::getTolerance | ( |  | ) |

Get the conjugate gradient convergence tolerance.

Returns
  the convergence tolerance

## setMatrix()

void SurgSim::Math::LinearSparseSolveAndInverseCG::setMatrix | ( | const SparseMatrix & | matrix | ) |

override virtual

Set the linear solver matrix.

Parameters

  matrix | the new matrix to solve/inverse for

Implements SurgSim::Math::LinearSparseSolveAndInverse.

## setMaxIterations()

void SurgSim::Math::LinearSparseSolveAndInverseCG::setMaxIterations | ( | SparseMatrix::Index | iterations | ) |

Set the maximum number of iterations for conjugate gradient.

Parameters

  iterations | the new maximum number of iterations

## setTolerance()

void SurgSim::Math::LinearSparseSolveAndInverseCG::setTolerance | ( | double | tolerance | ) |

Set the conjugate gradient convergence tolerance.

Parameters

  tolerance | the new convergence tolerance

## solve()

Matrix SurgSim::Math::LinearSparseSolveAndInverseCG::solve | ( | const Matrix & | b | ) | const

override virtual

Solve the linear system (matrix.x=b) using the matrix provided by the latest setMatrix call for all columns of the rhs matrix b.

Parameters

  b | The rhs matrix

Returns
  The solution matrix

Implements SurgSim::Math::LinearSparseSolveAndInverse.

## Member Data Documentation

## m_solver

Eigen::ConjugateGradient<SparseMatrix> SurgSim::Math::LinearSparseSolveAndInverseCG::m_solver

private

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

- SurgSim/Math/LinearSparseSolveAndInverse.h
- SurgSim/Math/LinearSparseSolveAndInverse.cpp