Skip to content

Commit 7f6ccb7

Browse files
committed
decompositions/SparseLU: fix compatibility with Eigen 5+
1 parent 25766e8 commit 7f6ccb7

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

include/eigenpy/decompositions/sparse/SparseLU.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,14 @@ struct SparseLUVisitor : public boost::python::def_visitor<
9898

9999
typedef typename Solver::SCMatrix SCMatrix;
100100
typedef typename MatrixType::StorageIndex StorageIndex;
101+
102+
#if EIGEN_VERSION_AT_LEAST(3, 4, 90)
103+
typedef Eigen::Map<Eigen::SparseMatrix<Scalar, Eigen::ColMajor, StorageIndex>>
104+
MappedSparseMatrix;
105+
#else
101106
typedef Eigen::MappedSparseMatrix<Scalar, Eigen::ColMajor, StorageIndex>
102107
MappedSparseMatrix;
108+
#endif
103109
typedef Eigen::SparseLUMatrixLReturnType<SCMatrix> LType;
104110
typedef Eigen::SparseLUMatrixUReturnType<SCMatrix, MappedSparseMatrix> UType;
105111

src/decompositions/sparse-lu-solver.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@ void exposeSparseLUSolver() {
1515

1616
typedef typename SparseLUType::Scalar Scalar;
1717
typedef typename SparseLUType::SCMatrix SCMatrix;
18-
typedef Eigen::MappedSparseMatrix<Scalar, ColMajor, StorageIndex>
18+
19+
#if EIGEN_VERSION_AT_LEAST(3, 4, 90)
20+
typedef Eigen::Map<Eigen::SparseMatrix<Scalar, Eigen::ColMajor, StorageIndex>>
21+
MappedSparseMatrix;
22+
#else
23+
typedef Eigen::MappedSparseMatrix<Scalar, Eigen::ColMajor, StorageIndex>
1924
MappedSparseMatrix;
25+
#endif
2026

2127
SparseLUMatrixLReturnTypeVisitor<SCMatrix>::expose(
2228
("SparseLUMatrixLReturnType"));

0 commit comments

Comments
 (0)