koblas

F64SparseMatrix

@Serializable
@SerialName(value = "F64SparseMatrix")
class F64SparseMatrix : F64MatrixView(source)

Compressed-sparse-column form: column j occupies colPtr(j) until colPtr(j + 1) of rowIdx and values, rows strictly ascending. A stored zero is preserved, and a 64-bit-index host library needs a widening copy.

Types

Link copied to clipboard
object Companion

Factories for sparse matrices.

Properties

colPtr

cols

open override val cols: Int(source)

nnz

val nnz: Int(source)

Number of stored nonzeros.

rowIdx

rows

open override val rows: Int(source)

values

Functions

copyColumnPointers

A copy of the CSC column start offsets, of length cols + 1.

copyRowIndices

A copy of the stored row indices, parallel to values.

equals

open operator override fun equals(other: Any?): Boolean(source)

Structural equality over the shape and the CSC arrays, so two matrices differing only in which explicit zeros they store are not equal.

forEachInColumn

inline fun forEachInColumn(j: Int, action: (row: Int, value: Double) -> Unit)(source)

Visits the stored entries of column j as (row, value), rows ascending.

get

open operator override fun get(i: Int, j: Int): Double(source)

Reads entry (i, j), or 0.0 where nothing is stored. A binary search over the column, so O(log nnzⱼ) and fine for a probe; sweep with forEachInColumn instead.

hashCode

open override fun hashCode(): Int(source)

toArray

open override fun toArray(): Array<DoubleArray>(source)

Materialises into a fresh rows × cols array of rows; unstored entries stay zero.

toString

open override fun toString(): String(source)
Link copied to clipboard
fun F64SparseMatrix.gemv(x: DoubleArray, transpose: Boolean = false): DoubleArray

this · x, or thisᵀ · x when transpose, with the active backend (koblas).

Link copied to clipboard
fun F64SparseMatrix.lu(equilibrate: Boolean = false, dropTolerance: Double = NO_DROP): F64SparseFactorization

Factorize this sparse matrix with the active backend (koblas), the counterpart of F64DenseMatrix.lu.

Link copied to clipboard

Scale column j by d(j) in place for a CSC matrix. The pattern is untouched.

Link copied to clipboard

Matrix-vector product into a fresh dense result for any F64MatrixLike against any F64VectorLike. gemv provide transpose and destination-buffer variants.

Link copied to clipboard

Fresh transposed matrix, still CSC, which makes this the CSC-to-CSR conversion as well. Explicitly stored zeros survive.

Link copied to clipboard
fun F64SparseMatrix.trsv(x: DoubleArray, lower: Boolean, transpose: Boolean = false, unitDiag: Boolean = false)

Solve op(T) · x = b in place against this matrix's lower or upper triangle, with the active backend (koblas). See F64SparseBlas.trsv.

Link copied to clipboard

Fresh matrix with column column replaced by entering, still CSC. The replacement is structural, so an explicitly stored zero in entering survives as one.