Skip to content

Commit f728dfb

Browse files
committed
sparse: fix sorting of indices when needed
Only available from Eigen >= 3.4.90
1 parent f17456e commit f728dfb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

include/eigenpy/sparse/eigen-from-python.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright (c) 2024 INRIA
2+
// Copyright (c) 2024-2025 INRIA
33
//
44

55
#ifndef __eigenpy_sparse_eigen_from_python_hpp__
@@ -156,6 +156,10 @@ void eigen_sparse_matrix_from_py_construct(
156156
}
157157
MapMatOrRefType sparse_map(m, n, nnz, indptr.data(), indices_ptr, data_ptr);
158158

159+
#if EIGEN_VERSION_AT_LEAST(3, 4, 90)
160+
sparse_map.sortInnerIndices();
161+
#endif
162+
159163
new (raw_ptr) MatOrRefType(sparse_map);
160164
}
161165

0 commit comments

Comments
 (0)