Skip to content

Commit

Permalink
chore: optimize sparse matrix casting with python tuple (#4064)
Browse files Browse the repository at this point in the history
* optimize casting of sparse Eigen arrays

* move array

* Revert for safety
  • Loading branch information
Skylion007 authored Jul 13, 2022
1 parent 6b60d97 commit bc9315f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/pybind11/eigen.h
Original file line number Diff line number Diff line change
Expand Up @@ -692,9 +692,9 @@ struct type_caster<Type, enable_if_t<is_eigen_sparse<Type>::value>> {
array outerIndices((rowMajor ? src.rows() : src.cols()) + 1, src.outerIndexPtr());
array innerIndices(src.nonZeros(), src.innerIndexPtr());

return matrix_type(std::make_tuple(
return matrix_type(pybind11::make_tuple(
std::move(data), std::move(innerIndices), std::move(outerIndices)),
std::make_pair(src.rows(), src.cols()))
pybind11::make_tuple(src.rows(), src.cols()))
.release();
}

Expand Down

0 comments on commit bc9315f

Please sign in to comment.