ADD: added other eigen lib
This commit is contained in:
@@ -13,24 +13,20 @@ They are summarized in the following tables:
|
||||
|
||||
<table class="manual">
|
||||
<tr><th>Class</th><th>Solver kind</th><th>Matrix kind</th><th>Features related to performance</th>
|
||||
<th>License</th><th class="width20em"><p>Notes</p></th></tr>
|
||||
<th class="width20em"><p>Notes</p></th></tr>
|
||||
|
||||
<tr><td>SimplicialLLT \n <tt>\#include<Eigen/\link SparseCholesky_Module SparseCholesky\endlink></tt></td><td>Direct LLt factorization</td><td>SPD</td><td>Fill-in reducing</td>
|
||||
<td>LGPL</td>
|
||||
<td>SimplicialLDLT is often preferable</td></tr>
|
||||
|
||||
<tr><td>SimplicialLDLT \n <tt>\#include<Eigen/\link SparseCholesky_Module SparseCholesky\endlink></tt></td><td>Direct LDLt factorization</td><td>SPD</td><td>Fill-in reducing</td>
|
||||
<td>LGPL</td>
|
||||
<td>Recommended for very sparse and not too large problems (e.g., 2D Poisson eq.)</td></tr>
|
||||
|
||||
<tr><td>SparseLU \n <tt>\#include<Eigen/\link SparseLU_Module SparseLU\endlink></tt></td> <td>LU factorization </td>
|
||||
<td>Square </td><td>Fill-in reducing, Leverage fast dense algebra</td>
|
||||
<td>MPL2</td>
|
||||
<td>optimized for small and large problems with irregular patterns </td></tr>
|
||||
|
||||
<tr><td>SparseQR \n <tt>\#include<Eigen/\link SparseQR_Module SparseQR\endlink></tt></td> <td> QR factorization</td>
|
||||
<td>Any, rectangular</td><td> Fill-in reducing</td>
|
||||
<td>MPL2</td>
|
||||
<td>recommended for least-square problems, has a basic rank-revealing feature</td></tr>
|
||||
</table>
|
||||
|
||||
@@ -38,21 +34,18 @@ They are summarized in the following tables:
|
||||
|
||||
<table class="manual">
|
||||
<tr><th>Class</th><th>Solver kind</th><th>Matrix kind</th><th>Supported preconditioners, [default]</th>
|
||||
<th>License</th><th class="width20em"><p>Notes</p></th></tr>
|
||||
<th class="width20em"><p>Notes</p></th></tr>
|
||||
|
||||
<tr><td>ConjugateGradient \n <tt>\#include<Eigen/\link IterativeLinearSolvers_Module IterativeLinearSolvers\endlink></tt></td> <td>Classic iterative CG</td><td>SPD</td>
|
||||
<td>IdentityPreconditioner, [DiagonalPreconditioner], IncompleteCholesky</td>
|
||||
<td>MPL2</td>
|
||||
<td>Recommended for large symmetric problems (e.g., 3D Poisson eq.)</td></tr>
|
||||
|
||||
<tr><td>LeastSquaresConjugateGradient \n <tt>\#include<Eigen/\link IterativeLinearSolvers_Module IterativeLinearSolvers\endlink></tt></td><td>CG for rectangular least-square problem</td><td>Rectangular</td>
|
||||
<td>IdentityPreconditioner, [LeastSquareDiagonalPreconditioner]</td>
|
||||
<td>MPL2</td>
|
||||
<td>Solve for min |A'Ax-b|^2 without forming A'A</td></tr>
|
||||
<td>Solve for min |Ax-b|^2 without forming A'A</td></tr>
|
||||
|
||||
<tr><td>BiCGSTAB \n <tt>\#include<Eigen/\link IterativeLinearSolvers_Module IterativeLinearSolvers\endlink></tt></td><td>Iterative stabilized bi-conjugate gradient</td><td>Square</td>
|
||||
<td>IdentityPreconditioner, [DiagonalPreconditioner], IncompleteLUT</td>
|
||||
<td>MPL2</td>
|
||||
<td>To speedup the convergence, try it with the \ref IncompleteLUT preconditioner.</td></tr>
|
||||
</table>
|
||||
|
||||
@@ -82,6 +75,9 @@ They are summarized in the following tables:
|
||||
<tr><td>PardisoLLT \n PardisoLDLT \n PardisoLU</td><td>\link PardisoSupport_Module PardisoSupport \endlink</td><td>Direct LLt, LDLt, LU factorizations</td><td>SPD \n SPD \n Square</td><td>Fill-in reducing, Leverage fast dense algebra, Multithreading</td>
|
||||
<td>Requires the <a href="http://eigen.tuxfamily.org/Counter/redirect_to_mkl.php">Intel MKL</a> package, \b Proprietary </td>
|
||||
<td>optimized for tough problems patterns, see also \link TopicUsingIntelMKL using MKL with Eigen \endlink</td></tr>
|
||||
<tr><td>AccelerateLLT \n AccelerateLDLT \n AccelerateQR</td><td>\link AccelerateSupport_Module AccelerateSupport \endlink</td><td>Direct LLt, LDLt, QR factorizations</td><td>SPD \n SPD \n Rectangular</td><td>Fill-in reducing, Leverage fast dense algebra, Multithreading</td>
|
||||
<td>Requires the <a href="https://developer.apple.com/documentation/accelerate">Apple Accelerate</a> package, \b Proprietary </td>
|
||||
<td></td></tr>
|
||||
</table>
|
||||
|
||||
Here \c SPD means symmetric positive definite.
|
||||
@@ -137,7 +133,7 @@ x1 = solver.solve(b1);
|
||||
x2 = solver.solve(b2);
|
||||
...
|
||||
\endcode
|
||||
The compute() method is equivalent to calling both analyzePattern() and factorize().
|
||||
The `compute()` method is equivalent to calling both `analyzePattern()` and `factorize()`.
|
||||
|
||||
Each solver provides some specific features, such as determinant, access to the factors, controls of the iterations, and so on.
|
||||
More details are available in the documentations of the respective classes.
|
||||
@@ -145,9 +141,9 @@ More details are available in the documentations of the respective classes.
|
||||
Finally, most of the iterative solvers, can also be used in a \b matrix-free context, see the following \link MatrixfreeSolverExample example \endlink.
|
||||
|
||||
\section TheSparseCompute The Compute Step
|
||||
In the compute() function, the matrix is generally factorized: LLT for self-adjoint matrices, LDLT for general hermitian matrices, LU for non hermitian matrices and QR for rectangular matrices. These are the results of using direct solvers. For this class of solvers precisely, the compute step is further subdivided into analyzePattern() and factorize().
|
||||
In the `compute()` function, the matrix is generally factorized: LLT for self-adjoint matrices, LDLT for general hermitian matrices, LU for non hermitian matrices and QR for rectangular matrices. These are the results of using direct solvers. For this class of solvers precisely, the compute step is further subdivided into `analyzePattern()` and `factorize()`.
|
||||
|
||||
The goal of analyzePattern() is to reorder the nonzero elements of the matrix, such that the factorization step creates less fill-in. This step exploits only the structure of the matrix. Hence, the results of this step can be used for other linear systems where the matrix has the same structure. Note however that sometimes, some external solvers (like SuperLU) require that the values of the matrix are set in this step, for instance to equilibrate the rows and columns of the matrix. In this situation, the results of this step should not be used with other matrices.
|
||||
The goal of `analyzePattern()` is to reorder the nonzero elements of the matrix, such that the factorization step creates less fill-in. This step exploits only the structure of the matrix. Hence, the results of this step can be used for other linear systems where the matrix has the same structure. Note however that sometimes, some external solvers (like SuperLU) require that the values of the matrix are set in this step, for instance to equilibrate the rows and columns of the matrix. In this situation, the results of this step should not be used with other matrices.
|
||||
|
||||
Eigen provides a limited set of methods to reorder the matrix in this step, either built-in (COLAMD, AMD) or external (METIS). These methods are set in template parameter list of the solver :
|
||||
\code
|
||||
@@ -156,21 +152,21 @@ DirectSolverClassName<SparseMatrix<double>, OrderingMethod<IndexType> > solver;
|
||||
|
||||
See the \link OrderingMethods_Module OrderingMethods module \endlink for the list of available methods and the associated options.
|
||||
|
||||
In factorize(), the factors of the coefficient matrix are computed. This step should be called each time the values of the matrix change. However, the structural pattern of the matrix should not change between multiple calls.
|
||||
In `factorize()`, the factors of the coefficient matrix are computed. This step should be called each time the values of the matrix change. However, the structural pattern of the matrix should not change between multiple calls.
|
||||
|
||||
For iterative solvers, the compute step is used to eventually setup a preconditioner. For instance, with the ILUT preconditioner, the incomplete factors L and U are computed in this step. Remember that, basically, the goal of the preconditioner is to speedup the convergence of an iterative method by solving a modified linear system where the coefficient matrix has more clustered eigenvalues. For real problems, an iterative solver should always be used with a preconditioner. In Eigen, a preconditioner is selected by simply adding it as a template parameter to the iterative solver object.
|
||||
\code
|
||||
IterativeSolverClassName<SparseMatrix<double>, PreconditionerName<SparseMatrix<double> > solver;
|
||||
\endcode
|
||||
The member function preconditioner() returns a read-write reference to the preconditioner
|
||||
The member function `preconditioner()` returns a read-write reference to the preconditioner
|
||||
to directly interact with it. See the \link IterativeLinearSolvers_Module Iterative solvers module \endlink and the documentation of each class for the list of available methods.
|
||||
|
||||
\section TheSparseSolve The Solve step
|
||||
The solve() function computes the solution of the linear systems with one or many right hand sides.
|
||||
The `solve()` function computes the solution of the linear systems with one or many right hand sides.
|
||||
\code
|
||||
X = solver.solve(B);
|
||||
\endcode
|
||||
Here, B can be a vector or a matrix where the columns form the different right hand sides. The solve() function can be called several times as well, for instance when all the right hand sides are not available at once.
|
||||
Here, B can be a vector or a matrix where the columns form the different right hand sides. `The solve()` function can be called several times as well, for instance when all the right hand sides are not available at once.
|
||||
\code
|
||||
x1 = solver.solve(b1);
|
||||
// Get the second right hand side b2
|
||||
@@ -180,7 +176,7 @@ x2 = solver.solve(b2);
|
||||
For direct methods, the solution are computed at the machine precision. Sometimes, the solution need not be too accurate. In this case, the iterative methods are more suitable and the desired accuracy can be set before the solve step using \b setTolerance(). For all the available functions, please, refer to the documentation of the \link IterativeLinearSolvers_Module Iterative solvers module \endlink.
|
||||
|
||||
\section BenchmarkRoutine
|
||||
Most of the time, all you need is to know how much time it will take to solve your system, and hopefully, what is the most suitable solver. In Eigen, we provide a benchmark routine that can be used for this purpose. It is very easy to use. In the build directory, navigate to bench/spbench and compile the routine by typing \b make \e spbenchsolver. Run it with --help option to get the list of all available options. Basically, the matrices to test should be in <a href="http://math.nist.gov/MatrixMarket/formats.html">MatrixMarket Coordinate format</a>, and the routine returns the statistics from all available solvers in Eigen.
|
||||
Most of the time, all you need is to know how much time it will take to solve your system, and hopefully, what is the most suitable solver. In Eigen, we provide a benchmark routine that can be used for this purpose. It is very easy to use. In the build directory, navigate to `bench/spbench` and compile the routine by typing `make spbenchsolver`. Run it with `--help` option to get the list of all available options. Basically, the matrices to test should be in <a href="http://math.nist.gov/MatrixMarket/formats.html">MatrixMarket Coordinate format</a>, and the routine returns the statistics from all available solvers in Eigen.
|
||||
|
||||
To export your matrices and right-hand-side vectors in the matrix-market format, you can the the unsupported SparseExtra module:
|
||||
\code
|
||||
|
||||
Reference in New Issue
Block a user