← Back

Module linalg

fn matmul[T](self: &NDArray[T; 2], other: &NDArray[T; 2]) -> NDArray[T; 2]

Matrix multiplication (rank 2 only). For energy-conscious code, prefer smaller matrices or approximate methods. A 1000x1000 matmul costs ~1.2 billion MACs at 1.2 pJ each = ~1.44 mJ.

Source: linalg.joule:23

fn dot[T](self: &NDArray[T; 1], other: &NDArray[T; 1]) -> T

Dot product of two rank-1 arrays.

Source: linalg.joule:39

fn norm[T](self: &NDArray[T; 1]) -> T

L2 (Euclidean) norm of a rank-1 array.

Source: linalg.joule:45

fn cross[T](self: &NDArray[T; 1], other: &NDArray[T; 1]) -> NDArray[T; 1]

3D cross product (only valid for arrays of length 3).

Source: linalg.joule:51

fn transpose[T](self: &NDArray[T; 2]) -> NDView[T; 2]

Transpose a matrix by swapping strides (rank 2 only). Returns an NDView — zero-copy, O(1).

Source: linalg.joule:67