Skip to content

la

fn cholesky #

fn cholesky[T](a &vtl.Tensor[T]) !&vtl.Tensor[f64]

cholesky computes Cholesky factorization of a symmetric positive-definite matrix. Returns lower-triangular L where A = L * L^T.

fn cross #

fn cross[T](u &vtl.Tensor[T], v &vtl.Tensor[T]) !&vtl.Tensor[f64]

cross computes the 3D cross product of two vectors: u × v Both vectors must have length 3.

fn det #

fn det[T](t &vtl.Tensor[T]) !&vtl.Tensor[f64]

fn dot #

fn dot[T](a &vtl.Tensor[T], b &vtl.Tensor[T]) !&vtl.Tensor[f64]

fn inv #

fn inv[T](t &vtl.Tensor[T]) !&vtl.Tensor[f64]

fn lstsq #

fn lstsq[T](a &vtl.Tensor[T], b &vtl.Tensor[T]) !(&vtl.Tensor[f64], &vtl.Tensor[f64], int, &vtl.Tensor[f64])

lstsq solves the linear least-squares problem min ||Ax - B||_2. Returns (x, residuals, rank, singular_values).

fn lu #

fn lu[T](a &vtl.Tensor[T]) !(&vtl.Tensor[f64], &vtl.Tensor[f64], &vtl.Tensor[int])

lu computes LU decomposition with partial pivoting: PA = LU. Returns (L, U, piv) as 2D tensors. L shape: [m, min(m,n)], U shape: [min(m,n), n]

fn matmul #

fn matmul[T](a &vtl.Tensor[T], b &vtl.Tensor[T]) !&vtl.Tensor[f64]

fn matmul_vulkan #

fn matmul_vulkan[T](a &vtl.Tensor[T], b &vtl.Tensor[T]) !&vtl.Tensor[T]

matmul_vulkan fallback: delegates to la.matmul (CPU).

fn matmul_with_backend #

fn matmul_with_backend[T](a &vtl.Tensor[T], b &vtl.Tensor[T], backend vtl.Backend, strict bool) !&vtl.Tensor[f64]

matmul_with_backend computes matrix multiplication using runtime backend selection.

fn matrix_rank #

fn matrix_rank[T](a &vtl.Tensor[T], tol f64) !int

matrix_rank returns the effective numerical rank of A.

fn norm #

fn norm[T](t &vtl.Tensor[T], ord string) !&vtl.Tensor[f64]

norm returns the matrix norm of a tensor. ord: "F" (Frobenius, default), "1" (column sum), "I" (row sum / infinity).

fn outer #

fn outer[T](u &vtl.Tensor[T], v &vtl.Tensor[T]) !&vtl.Tensor[f64]

outer computes the outer product of two vectors. result[i,j] = u[i] * v[j] result shape: [u.len, v.len]

fn pinv #

fn pinv[T](a &vtl.Tensor[T], tol f64) !&vtl.Tensor[f64]

pinv computes the Moore-Penrose pseudoinverse of A using SVD.

fn qr #

fn qr[T](a &vtl.Tensor[T]) !(&vtl.Tensor[f64], &vtl.Tensor[f64])

qr computes QR factorization of A. Returns (Q, R) where Q is orthonormal and R is upper triangular. Q shape: [m, min(m,n)], R shape: [min(m,n), n]

fn solve #

fn solve[T](a &vtl.Tensor[T], b &vtl.Tensor[T]) !&vtl.Tensor[f64]

solve solves the linear system A * X = B for X given A and B. A must be square (m x m) and B has shape (m,) or (m, nrhs).

fn trace #

fn trace[T](t &vtl.Tensor[T]) !&vtl.Tensor[f64]

trace returns the sum of diagonal elements of a square matrix.