koblas

Matrix

interface Matrix(source)

Read-only matrix contract. Anything that only reads a matrix should take this.

Inheritors

Properties

cols

abstract val cols: Int(source)

Number of columns.

rows

abstract val rows: Int(source)

Number of rows.

Functions

get

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

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

toArray

abstract fun toArray(): Array<DoubleArray>(source)

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

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
@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.