koblas API reference
Dense and sparse linear algebra for Kotlin Multiplatform.
koblas provides read-only matrix/vector containers with sealed dense and sparse backings — MatrixView / DenseMatrix and VectorView / DenseVector / SparseVector, 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 SparseMatrix with matrix–vector products and a Markowitz-pivoting SparseLu 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 LinearAlgebra 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 ReferenceLinearAlgebra. Ergonomic entry points lu / LuDecomposition.solve / matMul delegate to the active backend.
Packages
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.
Sparse linear algebra over the CSC com.eignex.koblas.SparseMatrix, behind three swappable seams that mirror the dense ones.