Skip to main content

array2_to_mat

Function array2_to_mat 

Source
pub fn array2_to_mat<T>(arr: &Array2<T>) -> Mat<T>
where T: Zeroable + Field + Clone,
Expand description

Converts an ndarray Array2 to an OxiBLAS Mat by copying every element.

§Notes

This is always a copying conversion, regardless of whether arr is column-major, row-major, or otherwise strided: Mat allocates its own cache-line-aligned, potentially row-padded column-major buffer (see oxiblas_matrix::Mat), which is structurally incompatible with ndarray’s Vec-backed storage, so there is no layout for which arr’s buffer could be reused. If you need a real zero-copy view instead, use array_view_to_mat_ref (or array_view_to_mat_ref_or_transposed), which borrow arr’s existing buffer via MatRef with no allocation and no element copy whenever the layout allows it.