dataframe-learn-2.4.1.0: Interpretable, expression-returning machine learning for the dataframe ecosystem.
Safe HaskellNone
LanguageHaskell2010

DataFrame.LinearAlgebra

Description

Dependency-free dense linear algebra over row-major matrices, shared by the models in dataframe-learn. Solvers live in DataFrame.LinearAlgebra.Solve and eigenproblems in DataFrame.LinearAlgebra.Eigen.

Synopsis

Documentation

type Matrix = Vector (Vector Double) Source #

Row-major dense matrix: an outer boxed vector of equal-length rows. An n×d matrix has n rows of length d.

dot :: Vector Double -> Vector Double -> Double Source #

Inner product of two equal-length vectors.

axpy :: Double -> Vector Double -> Vector Double -> Vector Double Source #

axpy a x y = a*x + y.

scaleV :: Double -> Vector Double -> Vector Double Source #

Scalar-vector product.

matVec :: Matrix -> Vector Double -> Vector Double Source #

matVec A v for A of shape n×d and v of length d; result length n.

tMatVec :: Matrix -> Vector Double -> Vector Double Source #

tMatVec A v = Aᵀ v for A of shape n×d, v of length n; result length d.

gram :: Matrix -> Matrix Source #

gram A = Aᵀ A, the d×d symmetric matrix of column inner products.

transposeM :: Matrix -> Matrix Source #

Transpose an n×d matrix to d×n.

identityM :: Int -> Matrix Source #

d×d identity matrix.

logSumExp :: Vector Double -> Double Source #

Numerically stable log Σ exp xᵢ.

sqDist :: Vector Double -> Vector Double -> Double Source #

Squared Euclidean distance.

nearestCenter :: Vector (Vector Double) -> Vector Double -> (Int, Double) Source #

Index of and squared distance to the nearest centre.

epsNeighbors :: Double -> Matrix -> Int -> Vector Int Source #

Indices j (excluding i) within squared radius eps² of row i, by brute force; O(n d) per query.