mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Updates to the Sparse unsupported solvers module.
* change Sparse* specialization's signatures from <..., int Backend> to <..., typename Backend>. Update SparseExtra accordingly to use structs instead of the SparseBackend enum. * add SparseLDLT Cholmod specialization * for Cholmod and UmfPack, SparseLU, SparseLLT and SparseLDLT now use ei_solve_retval and have the new solve() method (to be closer to the 3.0 API). * fix doc
This commit is contained in:
@@ -25,6 +25,10 @@
|
||||
#include "sparse.h"
|
||||
#include <Eigen/SparseExtra>
|
||||
|
||||
#ifdef EIGEN_CHOLMOD_SUPPORT
|
||||
#include <Eigen/CholmodSupport>
|
||||
#endif
|
||||
|
||||
#ifdef EIGEN_TAUCS_SUPPORT
|
||||
#include <Eigen/TaucsSupport>
|
||||
#endif
|
||||
@@ -56,6 +60,29 @@ template<typename Scalar> void sparse_ldlt(int rows, int cols)
|
||||
|
||||
VERIFY_IS_APPROX(refMat2.template selfadjointView<Upper>() * x, b);
|
||||
VERIFY(refX.isApprox(x,test_precision<Scalar>()) && "LDLT: default");
|
||||
|
||||
#ifdef EIGEN_CHOLMOD_SUPPORT
|
||||
x = b;
|
||||
SparseLDLT<SparseSelfAdjointMatrix, Cholmod> ldlt2(m2);
|
||||
if (ldlt2.succeeded())
|
||||
ldlt2.solveInPlace(x);
|
||||
else
|
||||
std::cerr << "warning LDLT failed\n";
|
||||
|
||||
VERIFY_IS_APPROX(refMat2.template selfadjointView<Upper>() * x, b);
|
||||
VERIFY(refX.isApprox(x,test_precision<Scalar>()) && "LDLT: cholmod solveInPlace");
|
||||
|
||||
|
||||
SparseLDLT<SparseSelfAdjointMatrix, Cholmod> ldlt3(m2);
|
||||
if (ldlt3.succeeded())
|
||||
x = ldlt3.solve(b);
|
||||
else
|
||||
std::cerr << "warning LDLT failed\n";
|
||||
|
||||
VERIFY_IS_APPROX(refMat2.template selfadjointView<Upper>() * x, b);
|
||||
VERIFY(refX.isApprox(x,test_precision<Scalar>()) && "LDLT: cholmod solve");
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void test_sparse_ldlt()
|
||||
|
||||
Reference in New Issue
Block a user