16 #ifndef SURGSIM_MATH_LINEARSPARSESOLVEANDINVERSE_H 17 #define SURGSIM_MATH_LINEARSPARSESOLVEANDINVERSE_H 21 #pragma warning(disable:4244) 24 #include <Eigen/SparseCore> 25 #include <unordered_map> 27 #include <boost/assign/list_of.hpp> 44 LINEARSOLVER_CONJUGATEGRADIENT,
48 const std::unordered_map<LinearSolver, std::string, std::hash<int>> LinearSolverNames =
49 boost::assign::map_list_of
50 (LINEARSOLVER_LU,
"LINEARSOLVER_LU")
51 (LINEARSOLVER_CONJUGATEGRADIENT,
"LINEARSOLVER_CONJUGATEGRADIENT");
93 Eigen::SparseLU<SparseMatrix> m_solver;
103 void setTolerance(
double tolerance);
107 double getTolerance();
111 void setMaxIterations(Eigen::Index iterations);
115 Eigen::Index getMaxIterations();
122 Eigen::ConjugateGradient<SparseMatrix> m_solver;
129 #if defined(_MSC_VER) 133 #endif // SURGSIM_MATH_LINEARSPARSESOLVEANDINVERSE_H Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
Eigen::SparseMatrix< double > SparseMatrix
A sparse matrix.
Definition: SparseMatrix.h:32
Derivation for sparse CG solver.
Definition: LinearSparseSolveAndInverse.h:98
virtual Matrix getInverse() const
Definition: LinearSparseSolveAndInverse.cpp:26
Definitions of useful sparse matrix functions.
virtual Matrix solve(const Matrix &b) const =0
Solve the linear system (matrix.x=b) using the matrix provided by the latest setMatrix call for all c...
Definitions of small fixed-size square matrix types.
Definitions of small fixed-size vector types.
Derivation for sparse LU solver.
Definition: LinearSparseSolveAndInverse.h:83
SparseMatrix m_matrix
A copy of the system matrix for use when an inverse is necessary.
Definition: LinearSparseSolveAndInverse.h:78
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > Matrix
A dynamic size matrix.
Definition: Matrix.h:65
LinearSparseSolveAndInverse aims at performing an efficient linear system resolution and calculating ...
Definition: LinearSparseSolveAndInverse.h:57
virtual void setMatrix(const SparseMatrix &matrix)=0
Set the linear solver matrix.