diff options
author | Gael Guennebaud <g.gael@free.fr> | 2015-02-10 18:57:41 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2015-02-10 18:57:41 +0100 |
commit | c6e8caf0900ae303e9e7399bed00af705015ff17 (patch) | |
tree | 384831cf695f94eb5fca5744a1b05a9cf8930e85 /test | |
parent | d10d6a40dda3fb5ac9f401b8e6d9cede3f3ca34a (diff) |
Allows Lower|Upper as a template argument of CG and MINRES: in this case the full matrix will be considered.
Diffstat (limited to 'test')
-rw-r--r-- | test/conjugate_gradient.cpp | 6 | ||||
-rw-r--r-- | test/sparse_solver.h | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/test/conjugate_gradient.cpp b/test/conjugate_gradient.cpp index 869051b31..019cc4d64 100644 --- a/test/conjugate_gradient.cpp +++ b/test/conjugate_gradient.cpp @@ -12,13 +12,15 @@ template<typename T> void test_conjugate_gradient_T() { - ConjugateGradient<SparseMatrix<T>, Lower> cg_colmajor_lower_diag; - ConjugateGradient<SparseMatrix<T>, Upper> cg_colmajor_upper_diag; + ConjugateGradient<SparseMatrix<T>, Lower > cg_colmajor_lower_diag; + ConjugateGradient<SparseMatrix<T>, Upper > cg_colmajor_upper_diag; + ConjugateGradient<SparseMatrix<T>, Lower|Upper> cg_colmajor_loup_diag; ConjugateGradient<SparseMatrix<T>, Lower, IdentityPreconditioner> cg_colmajor_lower_I; ConjugateGradient<SparseMatrix<T>, Upper, IdentityPreconditioner> cg_colmajor_upper_I; CALL_SUBTEST( check_sparse_spd_solving(cg_colmajor_lower_diag) ); CALL_SUBTEST( check_sparse_spd_solving(cg_colmajor_upper_diag) ); + CALL_SUBTEST( check_sparse_spd_solving(cg_colmajor_loup_diag) ); CALL_SUBTEST( check_sparse_spd_solving(cg_colmajor_lower_I) ); CALL_SUBTEST( check_sparse_spd_solving(cg_colmajor_upper_I) ); } diff --git a/test/sparse_solver.h b/test/sparse_solver.h index 887ff02a9..6cf99e0b0 100644 --- a/test/sparse_solver.h +++ b/test/sparse_solver.h @@ -195,7 +195,10 @@ int generate_sparse_spd_problem(Solver& , typename Solver::MatrixType& A, typena dA = dM * dM.adjoint(); halfA.resize(size,size); - halfA.template selfadjointView<Solver::UpLo>().rankUpdate(M); + if(Solver::UpLo==(Lower|Upper)) + halfA = A; + else + halfA.template selfadjointView<Solver::UpLo>().rankUpdate(M); return size; } |