mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 05:05:11 +00:00
chore: optimize sparse matrix casting with python tuple (#4064)
* optimize casting of sparse Eigen arrays * move array * Revert for safety
This commit is contained in:
parent
6b60d97d30
commit
bc9315fe38
@ -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 outerIndices((rowMajor ? src.rows() : src.cols()) + 1, src.outerIndexPtr());
|
||||||
array innerIndices(src.nonZeros(), src.innerIndexPtr());
|
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::move(data), std::move(innerIndices), std::move(outerIndices)),
|
||||||
std::make_pair(src.rows(), src.cols()))
|
pybind11::make_tuple(src.rows(), src.cols()))
|
||||||
.release();
|
.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user