SparseLDLSolver
This component belongs to the category of LinearSolver. The role of the SparseLDLSolver is to solve the linear system assuming that the matrix is symmetric and sparse.
To do so, the SparseLDLSolver relies on the method of LDL decomposition. The system matrix will be decomposed , where is a lower triangular matrix and is a diagonal matrix. This decomposition is an extension of the Cholesky decomposition which reduces its numerical inaccuracy.
As a direct solver, the SparseLDLSolver computes at each simulation time step an exact solution as follows:
Using a block forward substitution, we successively solve two triangular systems. Between those two resolutions, we need to inverse , which is trivial as it is a diagonal matrix that has no null value on its diagonal.
It is important to note that this decomposition considers that the system matrix is symmetric.
Sequence diagram
Data
There are two boolean Data to change the behavior of this solver:

useSymbolicDecomposition: by default useSymbolicDecomposition is set to true. The solver will use a symbolic decomposition, meaning that it will store the shape of on the first step, or when its shape changes, and then it will only update its coefficients. When the shape of the matrix changes, a new factorization is computed. By setting this data to false, the solver will compute the entire decomposition at each step.

applyPermutation: by default it is set to true. It will apply fill reducing permutation on the rows and the columns of in order to minimize the number of non null values in . Instead of solving , we will solve . Moreover, is symmetric, so we will use the same permutation on the rows and on the columns with . We will factorize and then we will solve
As the impact of the use of fill reducing permutations on the performances is highly influenced by the repartition of the nodes used to model an object, we advise the users to test which type of permutation is the best suited for their simulations.
Usage
The SparseLDLSolver requires the use (above in the scene graph) of an integration scheme, and (below in the scene graph) of a MechanicalObject storing the state information that the SparseLDLSolver will access.
As a direct solver, the SparseLDLSolver might be extremely time consuming for large system. However, it will always give you an exact solution, making the assumption that the system matrix is symmetric.
Example
This component is used as follows in XML format:
or using SofaPython3:
An example scene involving a SparseLDLSolver is available in examples/Components/linearsolver/FEMBARSparseLDLSolver.scn
Last modified: 12 January 2023