diff options
author | Gael Guennebaud <g.gael@free.fr> | 2013-06-23 19:11:32 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2013-06-23 19:11:32 +0200 |
commit | d1d7a1ade9da009f11b8ff47222c6498fdd93aa2 (patch) | |
tree | cedec3a4f5baca85f4aa482fa3230b1bb8e22559 /test/sparse_solver.h | |
parent | fab023536980c0e90c89811f0cbed037d2539879 (diff) |
Workaround a bunch of stupid warnings in unit tests
Diffstat (limited to 'test/sparse_solver.h')
-rw-r--r-- | test/sparse_solver.h | 79 |
1 files changed, 40 insertions, 39 deletions
diff --git a/test/sparse_solver.h b/test/sparse_solver.h index 645a965bb..d84aff070 100644 --- a/test/sparse_solver.h +++ b/test/sparse_solver.h @@ -17,53 +17,54 @@ void check_sparse_solving(Solver& solver, const typename Solver::MatrixType& A, typedef typename Mat::Scalar Scalar; DenseRhs refX = dA.lu().solve(db); + { + Rhs x(b.rows(), b.cols()); + Rhs oldb = b; - Rhs x(b.rows(), b.cols()); - Rhs oldb = b; + solver.compute(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!"); - solver.compute(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>())); + 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>())); - 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(x.isApprox(refX,test_precision<Scalar>())); } - VERIFY(oldb.isApprox(b) && "sparse solver testing: the rhs should not be modified!"); - - VERIFY(x.isApprox(refX,test_precision<Scalar>())); - // test Block as the result and rhs: + // test dense Block as the result and rhs: { DenseRhs x(db.rows(), db.cols()); - DenseRhs b(db), oldb(db); + DenseRhs oldb(db); x.setZero(); - x.block(0,0,x.rows(),x.cols()) = solver.solve(b.block(0,0,b.rows(),b.cols())); - VERIFY(oldb.isApprox(b) && "sparse solver testing: the rhs should not be modified!"); + x.block(0,0,x.rows(),x.cols()) = solver.solve(db.block(0,0,db.rows(),db.cols())); + VERIFY(oldb.isApprox(db) && "sparse solver testing: the rhs should not be modified!"); VERIFY(x.isApprox(refX,test_precision<Scalar>())); } } |