koblas

koblas API reference

Dense and sparse linear algebra for Kotlin Multiplatform.

Every container and every backend half names its element type. Double precision is the only one implemented, so the names all begin F64, and the unqualified names are aliases for them: DenseMatrix is F64DenseMatrix. The README's "Element types" section says what an element type added later brings and what stays shared.

Koblas provides mutable owning containers through read-only matrix/vector contracts, with sealed dense and sparse backings — F64MatrixView / F64DenseMatrix and F64VectorView / F64DenseVector / F64SparseVector, all @Serializable so snapshots round-trip through kotlinx.serialization with their concrete storage preserved.

Light arithmetic lives as free functions over the views: BLAS-1/2 (dot, axpy, scale, ger, gemv, forEachStored) and an SPD suite (cholesky, solveSpd, invertSpd). Their inner loops route through an expect/actual primitive seam that uses SIMD (jdk.incubator.vector) on the JVM and scalar loops elsewhere.

Sparse linear algebra is a first-class peer: a CSC F64SparseMatrix with matrix–vector products and a Markowitz-pivoting F64SparseLuFactorization factorization with O(nnz) forward and transposed solves — the kernels a sparse simplex or Newton solver builds on.

The heavier level-2/3 and factorization work — gemv, gemm and a general LU factor / solve — sits behind the runtime-swappable F64LinearAlgebra backend so a native BLAS/LAPACK implementation can replace it without changing callers. koblas resolves to an installBackends override when set, else the platform backend when present, else the pure-Kotlin F64ReferenceLinearAlgebra. Ergonomic entry points lu / F64LuDecomposition.solve delegate to the active backend.

Packages

Link copied to clipboard
common

The containers every part of koblas speaks, and the free-function arithmetic over them. The routines themselves live one package down, split by storage: com.eignex.koblas.dense and com.eignex.koblas.sparse. See the README's "BLAS coverage" table for the routine-by-routine mapping to BLAS/LAPACK and the deliberate deviations.

Link copied to clipboard
common
Link copied to clipboard
common

Dense linear algebra: the three swappable seams and the routines behind them.

Link copied to clipboard
common
Link copied to clipboard
common
host
Link copied to clipboard
Link copied to clipboard
common
Link copied to clipboard
Link copied to clipboard
common

Sparse linear algebra over the CSC com.eignex.koblas.core.F64SparseMatrix, behind three swappable seams that mirror the dense ones.

common
Link copied to clipboard
common
host
Link copied to clipboard
common
host
Link copied to clipboard
common
host
Link copied to clipboard
common
host