Pure functional, no NIF, no broadcasting beyond scalar/vector. For heavy
linear algebra, defer to viva_tensor.
pub fn add(
a: List(Float),
b: List(Float),
) -> Result(List(Float), Nil)
Element-wise add. Errors on length mismatch.
pub fn add_scalar(v: List(Float), s: Float) -> List(Float)
pub fn clamp(v: List(Float), lo: Float, hi: Float) -> List(Float)
pub fn distance(
a: List(Float),
b: List(Float),
) -> Result(Float, Nil)
pub fn dot(a: List(Float), b: List(Float)) -> Result(Float, Nil)
pub fn length(v: List(Float)) -> Float
Length using progressive hypot reduction to avoid overflow.
pub fn length_squared(v: List(Float)) -> Float
pub fn lerp(
a: List(Float),
b: List(Float),
t: Float,
) -> Result(List(Float), Nil)
pub fn mean(v: List(Float)) -> Result(Float, Nil)
pub fn multiply(
a: List(Float),
b: List(Float),
) -> Result(List(Float), Nil)
pub fn negate(v: List(Float)) -> List(Float)
pub fn normalize(v: List(Float)) -> List(Float)
pub fn ones(n: Int) -> List(Float)
pub fn scale(v: List(Float), s: Float) -> List(Float)
pub fn splat(value: Float, n: Int) -> List(Float)
pub fn sub(
a: List(Float),
b: List(Float),
) -> Result(List(Float), Nil)
pub fn sum(v: List(Float)) -> Float
pub fn zeros(n: Int) -> List(Float)
pub fn zip_with(
a: List(Float),
b: List(Float),
f: fn(Float, Float) -> Float,
) -> Result(List(Float), Nil)
Component-wise zip with a custom binary function.