mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-01-30 17:40:05 +08:00
add unit tests for analyzePatter/factorize API
This commit is contained in:
parent
bc8188f6a1
commit
b240a3fad9
@ -46,10 +46,30 @@ void check_sparse_solving(Solver& solver, const typename Solver::MatrixType& A,
|
||||
x = solver.solve(b);
|
||||
if (solver.info() != Success)
|
||||
{
|
||||
std::cerr << "sparse SPD: solving failed\n";
|
||||
std::cerr << "sparse solver testing: solving failed\n";
|
||||
return;
|
||||
}
|
||||
VERIFY(oldb.isApprox(b) && "sparse SPD: the rhs should not be modified!");
|
||||
VERIFY(oldb.isApprox(b) && "sparse solver testing: the rhs should not be modified!");
|
||||
|
||||
VERIFY(x.isApprox(refX,test_precision<Scalar>()));
|
||||
|
||||
x.setZero();
|
||||
// test the analyze/factorize API
|
||||
solver.analyzePattern(A);
|
||||
solver.factorize(A);
|
||||
if (solver.info() != Success)
|
||||
{
|
||||
std::cerr << "sparse solver testing: factorization failed (check_sparse_solving)\n";
|
||||
exit(0);
|
||||
return;
|
||||
}
|
||||
x = solver.solve(b);
|
||||
if (solver.info() != Success)
|
||||
{
|
||||
std::cerr << "sparse solver testing: solving failed\n";
|
||||
return;
|
||||
}
|
||||
VERIFY(oldb.isApprox(b) && "sparse solver testing: the rhs should not be modified!");
|
||||
|
||||
VERIFY(x.isApprox(refX,test_precision<Scalar>()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user