DenseMatrix
Dense column-major matrix backed by a single contiguous DoubleArray of length rows * cols. Element (i, j) lives at data[i + j * rows], so each column is a contiguous run of rows doubles.
Column-major is the layout LAPACK and Fortran define, so a host library reads this backing directly: no row-major wrappers, no transposition into a temporary, and lda is simply rows. It also matches what the algorithms want. A triangular solve, an eta update and a Householder reflector are all column operations, and SparseMatrix is already CSC, so the dense and sparse sides of the library now agree on which axis is contiguous.
Flat layout buys three properties: one heap allocation rather than cols separate column arrays; cache-friendly sweeps across column boundaries; the SIMD primitives in the internal Primitives.kt can stream long runs without re-fetching column references on each iteration.
Serializes as its shape plus the flat backing — {"rows":2,"cols":2,"data":[…]} — which is both the compact form and the extensible one. It used to encode as a nested Array<DoubleArray> of rows, chosen for readability; that cost a bracket pair per row and, more importantly, could not carry a polymorphic type discriminator, so a DenseMatrix could not decode through MatrixView while a SparseMatrix could. A named-field object fixes both and leaves room to add fields later without breaking readers.
Unlike the read-only MatrixView contract, the concrete matrix exposes its flat data backing and elementwise set so in-place algorithms (factorizations, updates) can work without reallocating.
Constructors
DenseMatrix
Types
Factory entrypoints for DenseMatrix.
Functions
equals
get
hashCode
set
toArray
Materialise into a fresh Array<DoubleArray> of rows. Always allocates; the result is independent of any internal storage.
toString
Lower-triangular Cholesky decomposition A = L * LT, returned as a fresh matrix, from the installed backend; see Lapack.cholesky.
LU-factorize this square matrix with the active backend (koblas).
Matrix-matrix product this · other with the active backend.
Fresh transposed matrix Aᵀ. Always materializes; for products against a transposed operand, prefer the transpose flags on LinearAlgebra.gemv / LinearAlgebra.gemm, which read the original storage without copying.