9 #include "imstkIterativeLinearSolver.h" 11 #include <Eigen/IterativeLinearSolvers> 15 class LinearProjectionConstraint;
45 void solve(Vectord& x)
override;
51 void solve(Vectord& x,
const double tolerance);
61 void setSystem(std::shared_ptr<LinearSystemType> newSystem)
override;
76 void print()
const override;
88 m_FixedLinearProjConstraints = f;
95 return *m_FixedLinearProjConstraints;
102 m_DynamicLinearProjConstraints = f;
109 return *m_DynamicLinearProjConstraints;
116 void modifiedCGSolve(Vectord& x);
119 Eigen::ConjugateGradient<SparseMatrixd> m_cgSolver;
121 std::vector<LinearProjectionConstraint>* m_FixedLinearProjConstraints =
nullptr;
122 std::vector<LinearProjectionConstraint>* m_DynamicLinearProjConstraints =
nullptr;
Base class for iterative linear solvers.
double getResidual(const Vectord &x) override
Return the error calculated by the solver.
void setDynamicLinearProjectors(std::vector< LinearProjectionConstraint > *f)
Get the vector denoting the filter.
void setTolerance(const double tolerance)
Set solver tolerance.
virtual void setMaxNumIterations(const size_t maxIter) override
set/get the maximum number of iterations for the iterative solver.
void setLinearProjectors(std::vector< LinearProjectionConstraint > *f)
Get the vector denoting the filter.
void print() const override
Print solver information.
void setSystem(std::shared_ptr< LinearSystemType > newSystem) override
Sets the system. System of linear equations.
std::vector< LinearProjectionConstraint > & getDynamicLinearProjectors()
Get the vector denoting the filter.
void solve(Vectord &x) override
Do one iteration of the method.
void applyLinearProjectionFilter(Vectord &x, const std::vector< LinearProjectionConstraint > &linProj, const bool setVal)
Apply a filter to the vector supplied.
std::vector< LinearProjectionConstraint > & getLinearProjectors()
Get the vector denoting the filter.
Conjugate gradient sparse linear solver for Spd matrices.