Linear solvers
Once the integration scheme described how the linear matrix system is built, this system Ax=b must be solved in order to find the solution x(t+dt) at the next time step.
Two categories
To solve this system, two main categories of algorithms are available:
 direct solvers: these solvers aim at finding the exact solution x(t+dt) of the system by computing in one single step
A^{−1}b
. To do so, various methods exist to compute the inverse matrix of A. For smallsize linear systems, the direct methods will be efficient. Large and sparse systems may imply timeconsuming inverse of the matrix A. The advantage of direct methods is that they succeed to solve wellconditioned and even some quite illconditioned problems. The computation of the inverse of A often relies on decomposition of this matrix: Cholesky, LU or LDL and their sparse versions are available.  iterative solvers: contrary to direct solvers, iterative methods converge towards the solution gradually. The solution is approximated at each iteration a little bit more accurately, rather than computed in one single large iteration. With iterative methods, the error esimated in the solution decreases with the number of iterations. For wellconditioned problems (even large systems), the convergence remains monotonic. However, for illconditioned systems, the convergence might be much slower. Since these methods compute the residual r=Axb at each iteration, the matrix A does not have to be built to improve performances (only matrix vector computations). Numerical settings of the solver (maximum number of iterations, tolerance for instance) must be appropriately defined. Two available methods are the conjugate gradient method (using the CGLinearSolver) or the minimal residual method (using the MinResLinearSolver).
In the SOFA code
The abstract description is done within the MatrixLinearSolver and depends on the category of the linear system (i.e. direct or iterative):

with direct solvers, the integration scheme sucessively calls the two following functions:
invert(Matrix& M)
implementing the targeted decomposition method:
solve(Matrix& A, Vector& x, Vector& b)

with iterative solvers, the integration scheme only calls the function:
solve(Matrix& A, Vector& x, Vector& b)
and will handle these vectors as TempVectorContainer and create any new vector using the function vtmp.createTempVector() as follows:
typename Inherit::TempVectorContainer vtmp(this, params, A, x, b); Vector* r1 = vtmp.createTempVector();
Last modified: 23 March 2018