No matching definitions.

tur/vec

src/linalg/vec.tur

dynamic :float vector type (column vector)

defstruct

vec

(defstruct vec [])

a 1-column mat; alias for column vectors.

defn

vec--alloc-data

(vec--alloc-data [n] :)

Private helper: allocate float array

defn

vec--free-data

(vec--free-data [data] :)

Private helper: free float array

defn

vec-new

(vec-new [n] :)

create an uninitialized vector of length n

defn

vec-new-zeroed

(vec-new-zeroed [n] :)

create a zero-initialized vector of length n

defn

vec-from-list

(vec-from-list [xs] :)

create a vector from a cons list of floats

defn

vec-copy

(vec-copy [v] :)

create a deep copy of a vector

defn

vec-free

(vec-free [v] :)

free a vector

defn

vec-get

(vec-get [v i] :)

get element at index i with bounds checking

defn

vec-set!

(vec-set! [v i x] :)

set element at index i with bounds checking

defn

vec-len

(vec-len [v] :)

get vector length

defn

vec-add

(vec-add [a b] :)

Arithmetic operations

defn

vec-sub

(vec-sub [a b] :)

element-wise vector subtraction

defn

vec-scale

(vec-scale [v s] :)

scalar multiplication

defn

vec-dot

(vec-dot [a b] :)

dot product

defn

vec-outer

(vec-outer [a b] :)

outer product (returns a matrix)

defn

vec-norm

(vec-norm [v] :)

Euclidean norm (L2 norm)

defn

vec-norm-1

(vec-norm-1 [v] :)

L1 norm (sum of absolute values)

defn

vec-norm-inf

(vec-norm-inf [v] :)

L-infinity norm (maximum absolute value)

defn

vec-normalize

(vec-normalize [v] :)

normalize vector to unit length

defn

vec-approx-eq?

(vec-approx-eq? [a b tol] :)

check if two vectors are approximately equal