buildMatrix
fun <R : Nat, C : Nat> buildMatrix(natRows: R, natCols: C, initializer: MatrixBuilder<R, C>.() -> Unit): Matrix<R, C>(source)
Builds a matrix with the given dimensions using a DSL-style initializer.
Example:
val matrix = buildMatrix(2, 3) {
row(1.0, 2.0, 3.0)
row(4.0, 5.0, 6.0)
}Content copied to clipboard
Return
the constructed Matrix
Parameters
natRows
number of rows
natCols
number of columns
initializer
a builder lambda; each row call must provide exactly natCols elements
Throws
if a row has a different number of elements than natCols
if the number of rows added is not equal to natRows