Skip to content

Commit

Permalink
sparse vector fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreAmice committed Jun 13, 2024
1 parent 1f8e0c3 commit df10b67
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/pybind11/eigen/matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,11 @@ struct type_caster<Type, enable_if_t<is_eigen_sparse<Type>::value>> {
}

static handle cast(const Type &src, return_value_policy /* policy */, handle /* parent */) {
const_cast<Type &>(src).makeCompressed();
if constexpr (!std::is_same_v<Type, Eigen::SparseVector) {
const_cast<Type &>(src).makeCompressed();
// use type specific operations...
}


object matrix_type
= module_::import("scipy.sparse").attr(rowMajor ? "csr_matrix" : "csc_matrix");
Expand Down

0 comments on commit df10b67

Please sign in to comment.