Skip to main content

asfortranarray

Function asfortranarray 

Source
pub fn asfortranarray<T: Element, D: Dimension>(a: &Array<T, D>) -> Array<T, D>
Expand description

Return an array (Fortran-order) by transposing then cloning.

ferray stores in C-order; to get Fortran-style layout we materialize a new buffer in column-major order. The shape is preserved; only the memory layout differs (the element traversal order in iter() will follow C-order regardless after this round-trip).

Analogous to numpy.asfortranarray — return a copy in F-contiguous (column-major) memory layout. The element-iteration order (logical/row-major) is preserved, but flags().f_contiguous is true on the result.

Implementation: transpose → C-contiguous standard layout → transpose back. The double-transpose preserves logical values while producing physical column-major memory.