SparseVector
Compressed sparse vector: parallel indices/values arrays of equal length, each holding one nonzero entry. Immutable from the caller's perspective; to change the sparsity pattern, rebuild.
Indices are strictly ascending and in range, validated by the constructor. Three things depend on it: get binary-searches rather than scanning, a sparse-against-sparse dot merges the two index lists in one pass instead of looking each position up, and the storage order that forEachStored and iamax expose becomes index order — so a tie in iamax resolves to the lowest index, the same rule the dense vector follows. Strict ascent also rules out duplicate indices, which would otherwise leave get and forEachStored disagreeing about the value at a position.
of is the forgiving entry point: it sorts and sums duplicates, mirroring SparseMatrix.ofColumns.
Types
Factory entrypoints for SparseVector.
Functions
equals
get
hashCode
toDoubleArray
Materialise into a fresh dense DoubleArray. Always allocates; the returned array is independent of any internal storage, so the caller is free to mutate it.
toString
aT * b. Dense×dense routes through the active com.eignex.koblas.dense.VectorKernels; a mixed pair walks the sparse side and gathers from the dense one; anything else is read entry by entry.
Visit each stored entry of this as (index, value), in ascending index order for any storage. For DenseVector that's every index in 0 until size; for SparseVector that's the entries present in the parallel index/value arrays (which may include numerical zeros); for any other VectorLike it is every index, read through VectorLike.get.