Skip to content

Commit 7fe844e

Browse files
committed
Add fix for Eigen>=3.4.90
1 parent 77757f5 commit 7fe844e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

include/nanobind/eigen/sparse.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ template <typename T> struct type_caster<T, enable_if_t<is_eigen_sparse_matrix_v
8686
return false;
8787
}
8888

89-
value = SparseMap(rows, cols, nnz, outer_indices.data(), inner_indices.data(), values.data());
89+
SparseMap mapped_matrix(rows, cols, nnz, outer_indices.data(), inner_indices.data(), values.data());
90+
#if EIGEN_VERSION_AT_LEAST(3, 4, 90)
91+
mapped_matrix.sortInnerIndices();
92+
#endif
93+
value = mapped_matrix;
9094

9195
return true;
9296
}

0 commit comments

Comments
 (0)