← Back

Module elementwise

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

Element-wise addition. Shapes must match exactly.

Source: elementwise.joule:17

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

Element-wise subtraction.

Source: elementwise.joule:22

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

Element-wise multiplication (Hadamard product).

Source: elementwise.joule:27

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

Element-wise division.

Source: elementwise.joule:32

fn add_assign[T; const N: u32](self: &mut NDArray[T; N], other: &NDArray[T; N])

In-place addition: a[i] += b[i].

Source: elementwise.joule:42

fn sub_assign[T; const N: u32](self: &mut NDArray[T; N], other: &NDArray[T; N])

Source: elementwise.joule:46

fn mul_assign[T; const N: u32](self: &mut NDArray[T; N], other: &NDArray[T; N])

Source: elementwise.joule:50

fn div_assign[T; const N: u32](self: &mut NDArray[T; N], other: &NDArray[T; N])

Source: elementwise.joule:54

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

Multiply every element by a scalar.

Source: elementwise.joule:64

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

Add a scalar to every element.

Source: elementwise.joule:69

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

Negate every element.

Source: elementwise.joule:78

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

Absolute value of every element.

Source: elementwise.joule:83

fn fill[T; const N: u32](self: &mut NDArray[T; N], value: T)

Fill all elements with a value (in-place).

Source: elementwise.joule:89