MCPcopy Create free account
hub / github.com/PyO3/rust-numpy / try_as_matrix_mut

Method try_as_matrix_mut

src/array.rs:1716–1732  ·  view source on GitHub ↗
(
        &self,
    )

Source from the content-addressed store, hash-verified

1714
1715 #[cfg(feature = "nalgebra")]
1716 unsafe fn try_as_matrix_mut<R, C, RStride, CStride>(
1717 &self,
1718 ) -> Option<nalgebra::MatrixViewMut<'_, T, R, C, RStride, CStride>>
1719 where
1720 T: nalgebra::Scalar + Element,
1721 D: Dimension,
1722 R: nalgebra::Dim,
1723 C: nalgebra::Dim,
1724 RStride: nalgebra::Dim,
1725 CStride: nalgebra::Dim,
1726 {
1727 let (shape, strides) = try_as_matrix_shape_strides(self)?;
1728
1729 let storage = nalgebra::ViewStorageMut::from_raw_parts(self.data(), shape, strides);
1730
1731 Some(nalgebra::Matrix::from_data(storage))
1732 }
1733}
1734
1735impl<'py, T> PyArray0Methods<'py, T> for Bound<'py, PyArray0<T>> {}

Callers

nothing calls this directly

Calls 2

dataMethod · 0.80

Tested by

no test coverage detected