← Back

Module shape

fn len[T; const N: u32](self: &NDArray[T; N]) -> usize

Total number of elements.

Source: shape.joule:12

fn is_contiguous[T; const N: u32](self: &NDArray[T; N]) -> bool

Whether the array data is contiguous in memory (row-major).

Source: shape.joule:18

fn reshape[T; const N: u32](self: &NDArray[T; N], new_shape: &[usize; N]) -> NDArray[T; N]

Reshape to new dimensions (total elements must match). Returns a new NDArray — data is copied to ensure contiguity. Note: `reshape` preserves rank. For rank changes, use `flatten` or constructors.

Source: shape.joule:37

fn flatten[T; const N: u32](self: &NDArray[T; N]) -> NDArray[T; 1]

Flatten to rank-1 array (copies data).

Source: shape.joule:43

fn contiguous[T; const N: u32](self: &NDArray[T; N]) -> NDArray[T; N]

Create a contiguous copy (useful after slicing/transposing).

Source: shape.joule:49

fn clone[T; const N: u32](self: &NDArray[T; N]) -> NDArray[T; N]

Deep copy of the entire array.

Source: shape.joule:55

fn view[T; const N: u32](self: &NDArray[T; N]) -> NDView[T; N]

Create a zero-copy view of the entire array.

Source: shape.joule:70

fn contiguous[T; const N: u32](self: &NDView[T; N]) -> NDArray[T; N]

Materialize an NDView into an owned NDArray.

Source: shape.joule:81