koblas

Companion

Factories for dense matrices.

Functions

diagonal

fun diagonal(size: Int, diagonal: Double = 1.0): F64DenseMatrix(source)

Create a square identity matrix of the given size, scaled by diagonal.


Create the square matrix whose diagonal is values.

of

Copy an Array<DoubleArray> of rows into a fresh dense matrix, so rows(i) is row i.

ofColumns

Copy an Array<DoubleArray> of columns into a fresh dense matrix, so columns(j) is column j.

wrap

fun wrap(rows: Int, cols: Int, data: DoubleArray): F64DenseMatrix(source)

Wrap an existing flat DoubleArray without copying. The caller relinquishes ownership.

zero

fun zero(rows: Int, cols: Int = rows): F64DenseMatrix(source)

Create a zero matrix of shape rows x cols, square when cols is omitted.