From a7749c09bcf053ab781186f4da741eff93f201ca Mon Sep 17 00:00:00 2001 From: Christoph Hertzberg Date: Fri, 19 Feb 2021 19:36:18 +0100 Subject: [PATCH] Bug #1910: Make SparseCholesky work for RowMajor matrices --- Eigen/src/SparseCholesky/SimplicialCholesky.h | 8 ++++---- test/simplicial_cholesky.cpp | 13 ++++++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Eigen/src/SparseCholesky/SimplicialCholesky.h b/Eigen/src/SparseCholesky/SimplicialCholesky.h index 06edb8688..94c9f0f21 100644 --- a/Eigen/src/SparseCholesky/SimplicialCholesky.h +++ b/Eigen/src/SparseCholesky/SimplicialCholesky.h @@ -287,8 +287,8 @@ template struct traits CholMatrixType; typedef TriangularView MatrixL; typedef TriangularView MatrixU; - static inline MatrixL getL(const MatrixType& m) { return MatrixL(m); } - static inline MatrixU getU(const MatrixType& m) { return MatrixU(m.adjoint()); } + static inline MatrixL getL(const CholMatrixType& m) { return MatrixL(m); } + static inline MatrixU getU(const CholMatrixType& m) { return MatrixU(m.adjoint()); } }; template struct traits > @@ -301,8 +301,8 @@ template struct traits CholMatrixType; typedef TriangularView MatrixL; typedef TriangularView MatrixU; - static inline MatrixL getL(const MatrixType& m) { return MatrixL(m); } - static inline MatrixU getU(const MatrixType& m) { return MatrixU(m.adjoint()); } + static inline MatrixL getL(const CholMatrixType& m) { return MatrixL(m); } + static inline MatrixU getU(const CholMatrixType& m) { return MatrixU(m.adjoint()); } }; template struct traits > diff --git a/test/simplicial_cholesky.cpp b/test/simplicial_cholesky.cpp index e3c31e3ba..538d01ab5 100644 --- a/test/simplicial_cholesky.cpp +++ b/test/simplicial_cholesky.cpp @@ -9,9 +9,9 @@ #include "sparse_solver.h" -template void test_simplicial_cholesky_T() +template void test_simplicial_cholesky_T() { - typedef SparseMatrix SparseMatrixType; + typedef SparseMatrix SparseMatrixType; SimplicialCholesky chol_colmajor_lower_amd; SimplicialCholesky chol_colmajor_upper_amd; SimplicialLLT< SparseMatrixType, Lower> llt_colmajor_lower_amd; @@ -41,7 +41,10 @@ template void test_simplicial_cholesky_T() EIGEN_DECLARE_TEST(simplicial_cholesky) { - CALL_SUBTEST_1(( test_simplicial_cholesky_T() )); - CALL_SUBTEST_2(( test_simplicial_cholesky_T, int>() )); - CALL_SUBTEST_3(( test_simplicial_cholesky_T() )); + CALL_SUBTEST_11(( test_simplicial_cholesky_T() )); + CALL_SUBTEST_12(( test_simplicial_cholesky_T, int, ColMajor>() )); + CALL_SUBTEST_13(( test_simplicial_cholesky_T() )); + CALL_SUBTEST_21(( test_simplicial_cholesky_T() )); + CALL_SUBTEST_22(( test_simplicial_cholesky_T, int, RowMajor>() )); + CALL_SUBTEST_23(( test_simplicial_cholesky_T() )); }