koblas

MatrixStorage

@Serializable
sealed interface MatrixStorage : Matrix(source)

The matrix storages koblas itself defines, DenseMatrix and SparseMatrix.

Inheritors

Properties

Link copied to clipboard
abstract val cols: Int

Number of columns.

Link copied to clipboard
abstract val rows: Int

Number of rows.

Functions

Link copied to clipboard
fun Matrix.gemvInto(x: Vector, destination: DoubleArray)

gemvInto with alpha = 1, beta = 0, so destination receives A * x.

fun Matrix.gemvInto(alpha: Double, x: Vector, beta: Double, destination: DoubleArray)

y = alpha * A * x + beta * y (BLAS dgemv) into destination, for any Matrix against any Vector. beta == 0.0 overwrites destination without reading it, so a destination left holding NaN still yields a clean product.

Link copied to clipboard
abstract operator fun get(i: Int, j: Int): Double

The entry at row (i), column (j). Throws IndexOutOfBoundsException outside the shape, whatever the storage.

Link copied to clipboard

Matrix 1-norm, the maximum absolute column sum (LAPACK dlange with norm 1). This is the anorm rcond expects, computed before the matrix is factored.

Link copied to clipboard

Frobenius norm (LAPACK dlange with norm F). Rescales like norm2 against overflow and underflow.

Link copied to clipboard

Matrix infinity-norm, the maximum absolute row sum (LAPACK dlange with norm I). A NaN carries through as it does in norm1.

Link copied to clipboard

Scale column j by d(j) in place for dense or sparse storage: the product A * D.

Link copied to clipboard

Scale row i by d(i) in place for dense or sparse storage: the product D * A.

Link copied to clipboard
@JvmName(name = "multiply")
operator fun Matrix.times(x: Vector): DenseVector

Matrix-vector product into a fresh dense result for any Matrix against any Vector. gemvInto writes into a destination the caller owns, and provides the alpha and beta scalars.

Link copied to clipboard
abstract fun toArray(): Array<DoubleArray>

Materialise into a fresh Array<DoubleArray> of rows, independent of the internal storage.

Link copied to clipboard
fun MatrixStorage.trmm(b: DenseMatrix, lower: Boolean, transpose: Boolean = false, unitDiag: Boolean = false, right: Boolean = false, alpha: Double = 1.0, workspace: Workspace? = null)

B = alpha · op(T) · B, or B = alpha · B · op(T) when right (BLAS dtrmm).

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

Multiply x = op(T) · x in place (BLAS dtrmv) for dense or sparse storage.

Link copied to clipboard
fun MatrixStorage.trsm(b: DenseMatrix, lower: Boolean, transpose: Boolean = false, unitDiag: Boolean = false, right: Boolean = false, alpha: Double = 1.0, workspace: Workspace? = null)

B = alpha · op(T)⁻¹ · B, or B = alpha · B · op(T)⁻¹ when right (BLAS dtrsm); see DenseBlas.trsm and SparseBlas.trsm. Reads only the triangle lower selects, and a singular triangle yields infinities or NaNs.

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

Solve op(T) · x = b in place (BLAS dtrsv) for dense or sparse storage; see DenseBlas.trsv and SparseBlas.trsv. Reads only the triangle lower selects, and does not check the diagonal, so a singular triangle yields infinities or NaNs.