SOFA API  1a4bb3e7
Open source framework for multi-physics simuation
sofa::component::linearsolver::direct::SVDLinearSolver< TMatrix, TVector > Class Template Reference

#include <SVDLinearSolver.h>

Inheritance diagram for sofa::component::linearsolver::direct::SVDLinearSolver< TMatrix, TVector >:

Detailed Description

template<class TMatrix, class TVector>
class sofa::component::linearsolver::direct::SVDLinearSolver< TMatrix, TVector >

Linear system solver using the JacobiSVD decomposition of the Eigen library (http://eigen.tuxfamily.org/ , see also an excellent introduction in Numerical Recipes.) The Singular Value Decomposition is probably the most robust (and the slowest !) matrix factoring for linear equation solution. It works only for dense matrices (FullMatrix). The equation system Ax=b is solved using a decomposition of A=USV^T, where U is a n-by-n unitary, V is a p-by-p unitary, and S is a n-by-p real positive matrix which is zero outside of its main diagonal; the diagonal entries of S are known as the singular values of A and the columns of U and V are known as the left and right singular vectors of A respectively. In case of indefinite matrix, there is at least one null singular value, and there is no solution to the equation system except for special right-hand terms. The SVD solver solves the equation in the least-square sense: it finds the pseudo-solution x which minimizes Ax-b. The condition number of the matrix is a byproduct of the solution, written in attribute "conditionNumber" by method solve (Matrix& M, Vector& x, Vector& b).

Public Attributes

Data< boolf_verbose
 Dump system state at each iteration. More...
 
Data< Realf_minSingularValue
 Thershold under which a singular value is set to 0, for the stabilization of ill-conditioned system. More...
 
Data< Realf_conditionNumber
 Condition number of the matrix: ratio between the largest and smallest singular values. Computed in method solve. More...
 

Public Member Functions

 SOFA_CLASS (SOFA_TEMPLATE2(SVDLinearSolver, TMatrix, TVector), SOFA_TEMPLATE2(sofa::component::linearsolver::MatrixLinearSolver, TMatrix, TVector))
 
void solve (Matrix &M, Vector &x, Vector &b) override
 Solve Mx=b. More...
 
bool supportNonSymmetricSystem () const override
 
- Public Member Functions inherited from sofa::component::linearsolver::MatrixLinearSolver< TMatrix, TVector >
void resetSystem ()
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API void resetSystem ()
 
void resizeSystem (Size n)
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API void resizeSystem (Size)
 
void setSystemMBKMatrix (const core::MechanicalParams *mparams)
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API void setSystemMBKMatrix (const core::MechanicalParams *mparams)
 
void rebuildSystem (SReal, SReal)
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API void rebuildSystem (SReal massFactor, SReal forceFactor)
 
void setSystemLHVector (core::MultiVecDerivId v)
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API void setSystemLHVector (core::MultiVecDerivId v)
 
void applySystemSolution ()
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API void applySystemSolution ()
 
void applyConstraintForce (const sofa::core::ConstraintParams *, sofa::core::MultiVecDerivId, const linearalgebra::BaseVector *)
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API void applyConstraintForce (const sofa::core::ConstraintParams *, sofa::core::MultiVecDerivId, const linearalgebra::BaseVector *)
 
void computeResidual (const core::ExecParams *, linearalgebra::BaseVector *)
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API void computeResidual (const core::ExecParams *params, linearalgebra::BaseVector *f)
 
GraphScatteredVectorcreatePersistentVector ()
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API GraphScatteredVectorcreatePersistentVector ()
 
linearalgebra::BaseMatrixgetSystemBaseMatrix ()
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API linearalgebra::BaseMatrixgetSystemBaseMatrix ()
 
linearalgebra::BaseVectorgetSystemRHBaseVector ()
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API linearalgebra::BaseVectorgetSystemRHBaseVector ()
 
linearalgebra::BaseVectorgetSystemLHBaseVector ()
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API linearalgebra::BaseVectorgetSystemLHBaseVector ()
 
void checkLinearSystem ()
 
SOFA_COMPONENT_LINEARSOLVER_ITERATIVE_API void checkLinearSystem ()
 
bool addJMInvJtLocal (GraphScatteredMatrix *M, MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector, NoThreadManager >::ResMatrixType *result, const MatrixLinearSolver< GraphScatteredMatrix, GraphScatteredVector, NoThreadManager >::JMatrixType *J, const SReal fact)
 

Protected Member Functions

 SVDLinearSolver ()
 

Attribute details

◆ f_conditionNumber

template<class TMatrix , class TVector >
Data<Real> sofa::component::linearsolver::direct::SVDLinearSolver< TMatrix, TVector >::f_conditionNumber

Condition number of the matrix: ratio between the largest and smallest singular values. Computed in method solve.

◆ f_minSingularValue

template<class TMatrix , class TVector >
Data<Real> sofa::component::linearsolver::direct::SVDLinearSolver< TMatrix, TVector >::f_minSingularValue

Thershold under which a singular value is set to 0, for the stabilization of ill-conditioned system.

◆ f_verbose

template<class TMatrix , class TVector >
Data<bool> sofa::component::linearsolver::direct::SVDLinearSolver< TMatrix, TVector >::f_verbose

Dump system state at each iteration.

Constructor details

◆ SVDLinearSolver()

template<class TMatrix , class TVector >
sofa::component::linearsolver::direct::SVDLinearSolver< TMatrix, TVector >::SVDLinearSolver
protected

Function details

◆ SOFA_CLASS()

template<class TMatrix , class TVector >
sofa::component::linearsolver::direct::SVDLinearSolver< TMatrix, TVector >::SOFA_CLASS ( SOFA_TEMPLATE2(SVDLinearSolver< TMatrix, TVector >, TMatrix, TVector)  ,
SOFA_TEMPLATE2(sofa::component::linearsolver::MatrixLinearSolver, TMatrix, TVector)   
)

◆ solve()

template<class TMatrix , class TVector >
void sofa::component::linearsolver::direct::SVDLinearSolver< TMatrix, TVector >::solve ( Matrix M,
Vector x,
Vector b 
)
override

Solve Mx=b.

◆ supportNonSymmetricSystem()

template<class TMatrix , class TVector >
bool sofa::component::linearsolver::direct::SVDLinearSolver< TMatrix, TVector >::supportNonSymmetricSystem ( ) const
inlineoverride