Top-level
Owning dense and sparse containers, borrowed vector views, Workspace and high-level arithmetic. Ordinary use needs only com.eignex.koblas.*; Matrix and Vector are read-only contracts custom types can implement. Dense matrices are column-major and sparse matrices are validated CSC.
KoblasEngine.gemm and the * operator dispatch on runtime storage with dense or sparse operands on either side. Two sparse operands produce CSC storage; other built-in pairings produce dense storage. No sparse operand is densified to reach a kernel. Operators use the default engine. Dense operations and mixed CSC products address DenseMatrixRegion directly, including padded views.
Types
Exact portable and JVM SIMD engines for tests and benchmarks, without changing the default koblas.
JVM built-in engines.
Built-in engines on Kotlin/Native.
A dense vector that owns its whole buffer, so its entries are exactly values, in order and complete.
Mutable column-major storage with unit row stride, shared by DenseMatrix and DenseMatrixView. Entry A(i, j) is at offset + i + j * leadingDimension in values.
A borrowed rectangle of a DoubleArray, with explicit offset and leadingDimension. No entries are copied or owned. The backing buffer can also be mutated by its owner or other views. Unlike DenseMatrix, values need not have exactly rows * cols entries. Views use reference equality.
A vector that stores every one of its entries, addressed as a buffer, an origin and a step.
Operands whose shapes do not fit the routine.
Immutable dense and sparse BLAS with portable fallbacks.
The matrix storages koblas itself defines, DenseMatrix and SparseMatrix.
Compressed-sparse-column form: column j occupies colPointers(j) until colPointers(j + 1) of rowIndices and values, rows strictly ascending. A stored zero is preserved, and a 64-bit-index host library needs a widening copy.
Indices are strictly ascending and in range, validated by the constructor; of sorts and sums instead.
A mutable live window of size entries in values, starting at offset and separated by stride.
Marks direct access to live structural or factorization storage. Mutating these buffers can invalidate later operations; access is intended for backend interoperability and specialized kernels.
The vector storages koblas defines and serializes, ContiguousVector and SparseVector.
Properties
Functions
A borrowed view over this whole vector, keeping whatever origin and spacing it already has.
y = y + alpha * x. A sparse x touches only the positions it stores. A dense x with an identical mapping is read directly; other dense overlaps, or sparse values sharing the destination buffer, are snapshotted before writing. Custom Vector implementations are also snapshotted, since their backing storage is opaque.
Column j as a fresh vector, copied rather than viewed.
Column j as a fresh sparse vector. Runs in O(nnzⱼ) time and allocates copies of its stored indices and values, so later mutations to the returned vector's indices or values cannot affect this matrix. Explicitly stored zeros are preserved.
dst = src (BLAS dcopy). A sparse source zero-fills the destination first, so nothing survives. Identical dense mappings are a no-op. Overlapping dense slices with unit stride use an overlap-safe block move. Other overlapping sources are snapshotted before writing. Custom Vector implementations are also snapshotted, since their backing storage is opaque.
Visit each stored entry as (index, value), in ascending index order for any storage. A SparseVector may present numerical zeros as stored, and any other Vector has every index visited.
Zero-based logical index of the maximum absolute value (BLAS idamax), or -1 when empty. Dense vectors use DenseVectorKernels.iamax; sparse vectors visit only their stored entries. All-zero nonempty inputs return 0, as do sparse inputs whose maximum is an implicit zero. Strided views report their logical index rather than a backing-array offset.
Makes the stored entries match what structure promises, in place.
A - B, allocating. axpy with alpha = -1.0 accumulates into an existing operand.
a - b, allocating. axpy with alpha = -1.0 accumulates into an existing operand.
A - B, allocating an owned CSC structural union.
Whether these vectors address at least one common buffer entry.
A + B, allocating. axpy accumulates into an existing operand.
a + b, allocating. axpy accumulates into an existing operand.
A + B, allocating an owned CSC structural union.
Row i as a fresh vector, gathered across the backing. Prefer column where the algorithm allows.
Row i as a fresh sparse vector whose stored positions are the source columns. Runs in O(nnz) time, scanning every stored entry in the matrix to gather the ones in this row, and allocates arrays sized to its stored entries. The returned vector is independent of this matrix, and explicitly stored zeros are preserved.
v = alpha * v.
Fresh CSC matrix holding A + alpha * x * xT in its lower or upper triangle. The other triangle is copied unchanged. Unlike dense com.eignex.koblas.dense.DenseBlas.syr, this is not in place: a rank update can introduce entries that the source CSC pattern has no room to store.
Fresh CSC matrix holding A + alpha * (x * yT + y * xT) in its lower or upper triangle. The other triangle is copied unchanged. This structural counterpart of dense com.eignex.koblas.dense.DenseBlas.syr2 never mutates its source, because newly nonzero entries may require CSC fill.
A * B (BLAS dgemm), allocating. gemm accumulates into an existing C instead.
Matrix-vector product into a fresh dense result.
A * B for a dense left operand and sparse right operand, allocating dense storage.
alpha * A, allocating. scale multiplies in place.
alpha * x, allocating. scale multiplies in place.
Allocating product through koblas: two sparse operands give CSC storage, any other pairing dense.
A * B for a sparse left operand and dense right operand, allocating dense storage.
A * B for two sparse matrices, allocating the discovered CSC structure.
Fresh transposed matrix, with the active backend (koblas). For products, prefer the transpose flags on gemv and gemm, which read the original storage without copying. See DenseBlas.transpose.
Fresh transposed matrix, still CSC, which makes this the CSC-to-CSR conversion as well. Explicitly stored zeros survive, since the transpose is structural rather than arithmetic.
-A, allocating.
-x, allocating.
A borrowed strided slice, addressed in this vector's logical indices rather than its buffer's positions.