# Matrix

`interface Matrix<T> :``NDArray``<``T``>`

A general facade for a Matrix type. Allows for various backend to be implemented to actually perform the computation. A koma backend must both implement this class and MatrixFactory. A matrix is guaranteed to be 2D and to have a numerical type. For storage of arbitrary types and dimensions, see koma.ndarray.NDArray.

### Properties

Name Summary
T `open val T:``Matrix``<``T``>`
Transpose operator.
size `open val size:``Int`

### Functions

Name Summary
LU `abstract fun LU():``Triple``<``Matrix``<``T``>,``Matrix``<``T``>,``Matrix``<``T``>>`
LU Decomposition. Returns p, l, u matrices as a triple.
QR `abstract fun QR():``Pair``<``Matrix``<``T``>,``Matrix``<``T``>>`
SVD `abstract fun SVD():``Triple``<``Matrix``<``T``>,``Matrix``<``T``>,``Matrix``<``T``>>`
T `open fun T():``Matrix``<``T``>`
Transpose operator.
argMax `abstract fun argMax():``Int`
Row major 1D index.
argMin `abstract fun argMin():``Int`
Row major 1D index.
asColVector `open fun asColVector():``Matrix``<``T``>`
Returns the given vector as a row vector. Will call transpose() on row vectors
asRowVector `open fun asRowVector():``Matrix``<``T``>`
Returns the given vector as a row vector. Will call transpose() on column vectors
chol `abstract fun chol():``Matrix``<``T``>`
(lower triangular) Cholesky decomposition of the matrix. Matrix must be positive-semi definite.
copy `abstract fun copy():``Matrix``<``T``>`
Returns a copy of this matrix (same values, new memory)
cumSum `open fun cumSum():``Matrix``<``T``>`
Calculates the cumulative (ongoing) sum of a matrix's elements. For example, `cumsum(mat[1,2,3])` would return `mat[1,3,6]`. Assumes matrix type is convertible to double.
det `abstract fun det():``T`
Determinant of the matrix
diag `abstract fun diag():``Matrix``<``T``>`
div `abstract operator fun div(other:``Int``):``Matrix``<``T``>`
`abstract operator fun div(other:``T``):``Matrix``<``T``>`
elementSum `abstract fun elementSum():``T`
Sum of all the elements in the matrix.
elementTimes `abstract fun elementTimes(other:``Matrix``<``T``>):``Matrix``<``T``>`
Element-wise multiplication with another matrix
epow `abstract fun epow(other:``T``):``Matrix``<``T``>`
Element-wise exponentiation of each element in the matrix`abstract infix fun epow(other:``Int``):``Matrix``<``T``>`
expm `abstract fun expm():``Matrix``<``T``>`
Compute the matrix exponential e^x (NOT elementwise)
filterCols `open fun filterCols(f: (col:``Matrix``<``T``>) ->``Boolean``):``Matrix``<``T``>`
Builds a new matrix with a subset of the columns of this matrix, using only the columns for which the function f returns true.
filterColsIndexed `open fun filterColsIndexed(f: (colIndex:``Int``, col:``Matrix``<``T``>) ->``Boolean``):``Matrix``<``T``>`
Builds a new matrix with a subset of the columns of this matrix, using only the columns for which the function f returns true.
filterRows `open fun filterRows(f: (row:``Matrix``<``T``>) ->``Boolean``):``Matrix``<``T``>`
Builds a new matrix with a subset of the rows of this matrix, using only the rows for which the function f returns true.
filterRowsIndexed `open fun filterRowsIndexed(f: (rowIndex:``Int``, row:``Matrix``<``T``>) ->``Boolean``):``Matrix``<``T``>`
Builds a new matrix with a subset of the rows of this matrix, using only the rows for which the function f returns true.
forEachCol `open fun forEachCol(f: (``Matrix``<``T``>) ->``Unit``):``Unit`
Passes each col from left to right into a function.
forEachRow `open fun forEachRow(f: (``Matrix``<``T``>) ->``Unit``):``Unit`
Passes each row from top to bottom into a function.
getBaseArray `open fun getBaseArray():``Any`
getBaseMatrix `abstract fun getBaseMatrix():``Any`
Returns the underlying matrix object from the back-end this Matrix is wrapping. This should be used sparingly (as it breaks encapsulation), but it can increase performance by using computation specifically designed for a particular back-end. Code using this method should not rely on a particular back-end, and should always fallback to slow generic code if an unrecognized matrix is returned here (e.g. use get and set) to access the elements generically).
getByte `open fun getByte(vararg indices:``Int``):``Byte`
getCol `abstract fun getCol(col:``Int``):``Matrix``<``T``>`
getDouble `abstract fun getDouble(i:``Int``, j:``Int``):``Double`
`open fun getDouble(vararg indices:``Int``):``Double`
getDoubleData `abstract fun getDoubleData():``DoubleArray`
Retrieves the data formatted as doubles in row-major order This method is only for performance over potentially boxing get(Double) methods. This method may or may not return a copy, and thus should be treated as read-only unless backend behavior is known.
getFactory `abstract fun getFactory():``MatrixFactory``<``Matrix``<``T``>>`
Because sometimes all you have is a Matrix, but you really want a MatrixFactory.
getFloat `abstract fun getFloat(i:``Int``, j:``Int``):``Float`
`open fun getFloat(vararg indices:``Int``):``Float`
getGeneric `abstract fun getGeneric(i:``Int``, j:``Int``):``T`
`open fun getGeneric(vararg indices:``Int``):``T`
getInt `abstract fun getInt(i:``Int``, j:``Int``):``Int`
`open fun getInt(vararg indices:``Int``):``Int`
getLinear `open fun getLinear(index:``Int``):``T`
getLong `open fun getLong(vararg indices:``Int``):``Long`
getRow `abstract fun getRow(row:``Int``):``Matrix``<``T``>`
getShort `open fun getShort(vararg indices:``Int``):``Short`
inv `abstract fun inv():``Matrix``<``T``>`
Matrix inverse (square matrices)
mapCols `open fun mapCols(f: (``Matrix``<``T``>) ->``Matrix``<``T``>):``Matrix``<``T``>`
Takes each col in a matrix, passes them through f, and puts the output of f into a col of an output matrix.
mapColsToList `open fun <U> mapColsToList(f: (``Matrix``<``T``>) ->``U``):``List``<``U``>`
Takes each col in a matrix, passes them through f, and puts the outputs into a List. In contrast to this#mapCols, the usage of a list as the output container allows for arbitrary output types, such as taking a double matrix and returning a list of strings.
mapRows `open fun mapRows(f: (``Matrix``<``T``>) ->``Matrix``<``T``>):``Matrix``<``T``>`
Takes each row in a matrix, passes them through f, and puts the output of f into a row of an output matrix.
mapRowsToList `open fun <U> mapRowsToList(f: (``Matrix``<``T``>) ->``U``):``List``<``U``>`
Takes each row in a matrix, passes them through f, and puts the outputs into a List. In contrast to this#mapRows, the usage of a list as the output container allows for arbitrary output types, such as taking a double matrix and returning a list of strings.
max `abstract fun max():``T`
Maximum value contained in the matrix
mean `abstract fun mean():``T`
Mean (average) of all the elements in the matrix.
min `abstract fun min():``T`
Minimum value contained in the matrix
minus `abstract operator fun minus(other:``T``):``Matrix``<``T``>`
`abstract operator fun minus(other:``Matrix``<``T``>):``Matrix``<``T``>`
normF `abstract fun normF():``T`
Frobenius normal of the matrix
normIndP1 `abstract fun normIndP1():``T`
Induced, p=1 normal of the matrix. Equivalent of `norm(matrix,1)` in scipy.
numCols `abstract fun numCols():``Int`
Number of columns in the matrix
numRows `abstract fun numRows():``Int`
Number of rows in the matrix
pinv `abstract fun pinv():``Matrix``<``T``>`
Pseudo-inverse of (non-square) matrix
plus `abstract operator fun plus(other:``T``):``Matrix``<``T``>`
`abstract operator fun plus(other:``Matrix``<``T``>):``Matrix``<``T``>`
pow `open infix fun pow(exponent:``Int``):``Matrix``<``T``>`
Multiplies the matrix by itself exponent times (using matrix multiplication).
repr `open fun repr():``String`
selectCols `open fun selectCols(vararg idxs:``Int``):``Matrix``<``T``>`
Select a set of cols from a matrix to form the cols of a new matrix. For example, if you wanted a new matrix consisting of the first, second, and fifth cols of an input matrix, you would write `input.selectCols(0,1,4)`.`open fun <U :``Number``> selectCols(idxs:``Matrix``<``U``>):``Matrix``<``T``>`
selectRows `open fun selectRows(vararg idxs:``Int``):``Matrix``<``T``>`
Select a set of rows from a matrix to form the rows of a new matrix. For example, if you wanted a new matrix consisting of the first, second, and fifth rows of an input matrix, you would write `input.selectRows(0,1,4)`.`open fun <U :``Number``> selectRows(idxs:``Matrix``<``U``>):``Matrix``<``T``>`
setByte `open fun setByte(vararg indices:``Int``, value:``Byte``):``Nothing`
setCol `abstract fun setCol(index:``Int``, col:``Matrix``<``T``>):``Unit`
setDouble `abstract fun setDouble(i:``Int``, j:``Int``, v:``Double``):``Unit`
`open fun setDouble(vararg indices:``Int``, value:``Double``):``Unit`
setFloat `abstract fun setFloat(i:``Int``, j:``Int``, v:``Float``):``Unit`
`open fun setFloat(vararg indices:``Int``, value:``Float``):``Unit`
setGeneric `abstract fun setGeneric(i:``Int``, j:``Int``, v:``T``):``Unit`
`open fun setGeneric(vararg indices:``Int``, value:``T``):``Unit`
setInt `abstract fun setInt(i:``Int``, j:``Int``, v:``Int``):``Unit`
`open fun setInt(vararg indices:``Int``, value:``Int``):``Unit`
setLinear `open fun setLinear(index:``Int``, value:``T``):``Unit`
setLong `open fun setLong(vararg indices:``Int``, value:``Long``):``Nothing`
setRow `abstract fun setRow(index:``Int``, row:``Matrix``<``T``>):``Unit`
setShort `open fun setShort(vararg indices:``Int``, value:``Short``):``Nothing`
shape `open fun shape():``List``<``Int``>`
solve `abstract fun solve(other:``Matrix``<``T``>):``Matrix``<``T``>`
Solves A*X=B for X, returning X (X is either column vector or a matrix composed of several col vectors). A is the current matrix, B is the passed in other)/other), and X is the returned matrix.
times `abstract operator fun times(other:``Matrix``<``T``>):``Matrix``<``T``>`
`abstract operator fun times(other:``T``):``Matrix``<``T``>`
to2DArray `open fun to2DArray():``Array``<``DoubleArray``>`
Returns a Matrix as a double 2D array. Intended for MATLAB interop.
toIterable `open fun toIterable():``Iterable``<``T``>`
trace `abstract fun trace():``T`
The matrix trace.
transpose `abstract fun transpose():``Matrix``<``T``>`
Transpose of the matrix
unaryMinus `abstract operator fun unaryMinus():``Matrix``<``T``>`
wrapRange `open fun wrapRange(range:``IntRange``, max:``Int``):``IntRange`

### Inherited Functions

Name Summary
getByte `open fun getByte(i:``Int``):``Byte`
getDouble `open fun getDouble(i:``Int``):``Double`
getFloat `open fun getFloat(i:``Int``):``Float`
getGeneric `abstract fun getGeneric(i:``Int``):``T`
getInt `open fun getInt(i:``Int``):``Int`
getLong `open fun getLong(i:``Int``):``Long`
getShort `open fun getShort(i:``Int``):``Short`
iterateIndices `open fun iterateIndices():``Iterable``<``IndexIterator``>`
setByte `open fun setByte(i:``Int``, v:``Byte``):``Unit`
setDouble `open fun setDouble(i:``Int``, v:``Double``):``Unit`
setFloat `open fun setFloat(i:``Int``, v:``Float``):``Unit`
setGeneric `abstract fun setGeneric(i:``Int``, v:``T``):``Unit`
setInt `open fun setInt(i:``Int``, v:``Int``):``Unit`
setLong `open fun setLong(i:``Int``, v:``Long``):``Unit`
setShort `open fun setShort(i:``Int``, v:``Short``):``Unit`
toList `open fun toList():``List``<``T``>`
Converts this NDArray into a one-dimensional List in row-major order.
toMutableList `open fun toMutableList():``MutableList``<``T``>`
Converts this NDArray into a one-dimensional MutableList in row-major order.

### Companion Object Properties

Name Summary
doubleFactory `var doubleFactory:``MatrixFactory``<``Matrix``<``Double``>>`
Default factory that all top-level functions use when building new matrices. Double precision.
floatFactory `var floatFactory:``MatrixFactory``<``Matrix``<``Float``>>`
Default factory that all top-level functions use when building new matrices. Single precision.
intFactory `var intFactory:``MatrixFactory``<``Matrix``<``Int``>>`
Default factory that all top-level functions use when building new matrices. Integer matrices.

### Companion Object Functions

Name Summary
invoke `operator fun <T> invoke(rows:``Int``, cols:``Int``, filler: (``Int``,``Int``) ->``T``):``Matrix``<``T``>`

### Extension Functions

Name Summary
all `fun``Matrix``<``Double``>.all(f: (``Double``) ->``Boolean``):``Boolean`
`fun``Matrix``<``Float``>.all(f: (``Float``) ->``Boolean``):``Boolean`
`fun <T>``Matrix``<``T``>.all(f: (``T``) ->``Boolean``):``Boolean`
`fun``Matrix``<``Int``>.all(f: (``Int``) ->``Boolean``):``Boolean`
Checks to see if all elements cause f to return true.
allClose `fun``Matrix``<``Double``>.allClose(other:``Matrix``<``Double``>, rtol:``Double``= 1e-05, atol:``Double``= 1e-08):``Boolean`
`fun``Matrix``<``Float``>.allClose(other:``Matrix``<``Float``>, rtol:``Double``= 1e-05, atol:``Double``= 1e-08):``Boolean`
any `fun``Matrix``<``Double``>.any(f: (``Double``) ->``Boolean``):``Boolean`
`fun``Matrix``<``Float``>.any(f: (``Float``) ->``Boolean``):``Boolean`
`fun <T>``Matrix``<``T``>.any(f: (``T``) ->``Boolean``):``Boolean`
`fun``Matrix``<``Int``>.any(f: (``Int``) ->``Boolean``):``Boolean`
Checks to see if any element in the matrix causes f to return true.
checkIndices `fun <T>``NDArray``<``T``>.checkIndices(indices:``IntArray``):``IntArray`
checkLinearIndex `fun <T>``NDArray``<``T``>.checkLinearIndex(index:``Int``):``Int`
emul `infix fun``Matrix``<``Double``>.emul(other:``Matrix``<``Double``>):``Matrix``<``Double``>`
Allow infix operator "a emul b" to be element-wise multiplication of two matrices.
fill `fun``Matrix``<``Double``>.fill(f: (row:``Int``, col:``Int``) ->``Double``):``Matrix``<``Double``>`
`fun``Matrix``<``Float``>.fill(f: (row:``Int``, col:``Int``) ->``Float``):``Matrix``<``Float``>`
`fun <T>``Matrix``<``T``>.fill(f: (row:``Int``, col:``Int``) ->``T``):``Matrix``<``T``>`
`fun``Matrix``<``Int``>.fill(f: (row:``Int``, col:``Int``) ->``Int``):``Matrix``<``Int``>`
Fills the matrix with the values returned by the input function.`fun <T>``NDArray``<``T``>.fill(f: (idx:``IntArray``) ->``T``):``NDArray``<``T``>`
fillBoth `fun <T>``NDArray``<``T``>.fillBoth(f: (nd:``IntArray``, linear:``Int``) ->``T``):``NDArray``<``T``>`
fillLinear `fun <T>``NDArray``<``T``>.fillLinear(f: (idx:``Int``) ->``T``):``NDArray``<``T``>`
forEach `fun``Matrix``<``Double``>.forEach(f: (``Double``) ->``Unit``):``Unit`
`fun``Matrix``<``Float``>.forEach(f: (``Float``) ->``Unit``):``Unit`
`fun <T>``Matrix``<``T``>.forEach(f: (``T``) ->``Unit``):``Unit`
`fun``Matrix``<``Int``>.forEach(f: (``Int``) ->``Unit``):``Unit`
Passes each element in row major order into a function.`fun <T>``NDArray``<``T``>.forEach(f: (ele:``T``) ->``Unit``):``Unit`
Takes each element in a NDArray and passes them through f.
forEachIndexed `fun``Matrix``<``Double``>.forEachIndexed(f: (row:``Int``, col:``Int``, ele:``Double``) ->``Unit``):``Unit`
`fun``Matrix``<``Float``>.forEachIndexed(f: (row:``Int``, col:``Int``, ele:``Float``) ->``Unit``):``Unit`
`fun <T>``Matrix``<``T``>.forEachIndexed(f: (row:``Int``, col:``Int``, ele:``T``) ->``Unit``):``Unit`
`fun``Matrix``<``Int``>.forEachIndexed(f: (row:``Int``, col:``Int``, ele:``Int``) ->``Unit``):``Unit`
Passes each element in row major order into a function along with its index location.`fun <T>``NDArray``<``T``>.forEachIndexed(f: (idx:``Int``, ele:``T``) ->``Unit``):``Unit`
Takes each element in a NDArray and passes them through f. Index given to f is a linear index, depending on the underlying storage major dimension.
forEachIndexedN `fun <T>``NDArray``<``T``>.forEachIndexedN(f: (idx:``IntArray``, ele:``T``) ->``Unit``):``Unit`
Takes each element in a NDArray and passes them through f. Index given to f is the full ND index of the element.
get `operator fun``Matrix``<``Double``>.get(i:``Int``, j:``Int``):``Double`
`operator fun``Matrix``<``Float``>.get(i:``Int``, j:``Int``):``Float`
`operator fun <T>``Matrix``<``T``>.get(i:``Int``, j:``Int``):``T`
`operator fun``Matrix``<``Int``>.get(i:``Int``, j:``Int``):``Int`
`operator fun <T>``NDArray``<``T``>.get(vararg indices:``IntRange``):``NDArray``<``T``>`
`operator fun <T>``NDArray``<``T``>.get(vararg indices:``Int``):``T``operator fun``Matrix``<``Double``>.get(i:``Int``):``Double`
`operator fun``Matrix``<``Float``>.get(i:``Int``):``Float`
`operator fun <T>``Matrix``<``T``>.get(i:``Int``):``T`
`operator fun``Matrix``<``Int``>.get(i:``Int``):``Int`
Gets the ith element in the matrix. If 2D, selects elements in row-major order.`operator fun``Matrix``<``Double``>.get(rows:``IntRange``, cols:``IntRange``):``Matrix``<``Double``>`
`operator fun``Matrix``<``Float``>.get(rows:``IntRange``, cols:``IntRange``):``Matrix``<``Float``>`
`operator fun <T>``Matrix``<``T``>.get(rows:``IntRange``, cols:``IntRange``):``Matrix``<``T``>`
`operator fun``Matrix``<``Int``>.get(rows:``IntRange``, cols:``IntRange``):``Matrix``<``Int``>`
Allow slicing, e.g. `matrix[1..2, 3..4]`. Note that the range 1..2 is inclusive, so it will retrieve row 1 and 2. Use 1.until(2) for a non-inclusive range.`operator fun``Matrix``<``Double``>.get(rows:``IntRange``, cols:``Int``):``Matrix``<``Double``>`
`operator fun``Matrix``<``Float``>.get(rows:``IntRange``, cols:``Int``):``Matrix``<``Float``>`
`operator fun <T>``Matrix``<``T``>.get(rows:``IntRange``, cols:``Int``):``Matrix``<``T``>`
`operator fun``Matrix``<``Int``>.get(rows:``IntRange``, cols:``Int``):``Matrix``<``Int``>`
Allows for slicing of the rows and selection of a single column`operator fun``Matrix``<``Double``>.get(rows:``Int``, cols:``IntRange``):``Matrix``<``Double``>`
`operator fun``Matrix``<``Float``>.get(rows:``Int``, cols:``IntRange``):``Matrix``<``Float``>`
`operator fun <T>``Matrix``<``T``>.get(rows:``Int``, cols:``IntRange``):``Matrix``<``T``>`
`operator fun``Matrix``<``Int``>.get(rows:``Int``, cols:``IntRange``):``Matrix``<``Int``>`
Allows for slicing of the cols and selection of a single row
linearToNIdx `fun <T>``NDArray``<``T``>.linearToNIdx(linear:``Int``):``IntArray`
Given the 1D index of an element in the underlying storage, find the corresponding ND index. Inverse of nIdxToLinear.
map `fun``Matrix``<``Double``>.map(f: (``Double``) ->``Double``):``Matrix``<``Double``>`
`fun``Matrix``<``Float``>.map(f: (``Float``) ->``Float``):``Matrix``<``Float``>`
`fun <T>``Matrix``<``T``>.map(f: (``T``) ->``T``):``Matrix``<``T``>`
`fun``Matrix``<``Int``>.map(f: (``Int``) ->``Int``):``Matrix``<``Int``>`
Takes each element in a matrix, passes them through f, and puts the output of f into an output matrix. This process is done in row-major order.`fun <T>``NDArray``<``T``>.map(f: (``T``) ->``T``):``DefaultGenericNDArray``<``T``>`
Takes each element in a NDArray, passes them through f, and puts the output of f into an output NDArray.
mapIndexed `fun``Matrix``<``Double``>.mapIndexed(f: (row:``Int``, col:``Int``, ele:``Double``) ->``Double``):``Matrix``<``Double``>`
`fun``Matrix``<``Float``>.mapIndexed(f: (row:``Int``, col:``Int``, ele:``Float``) ->``Float``):``Matrix``<``Float``>`
`fun <T>``Matrix``<``T``>.mapIndexed(f: (row:``Int``, col:``Int``, ele:``T``) ->``T``):``Matrix``<``T``>`
`fun``Matrix``<``Int``>.mapIndexed(f: (row:``Int``, col:``Int``, ele:``Int``) ->``Int``):``Matrix``<``Int``>`
Takes each element in a matrix, passes them through f, and puts the output of f into an output matrix. This process is done in row-major order.`fun <T>``NDArray``<``T``>.mapIndexed(f: (idx:``Int``, ele:``T``) ->``T``):``DefaultGenericNDArray``<``T``>`
Takes each element in a NDArray, passes them through f, and puts the output of f into an output NDArray. Index given to f is a linear index, depending on the underlying storage major dimension.
mapIndexedN `fun <T>``NDArray``<``T``>.mapIndexedN(f: (idx:``IntArray``, ele:``T``) ->``T``):``NDArray``<``T``>`
Takes each element in a NDArray, passes them through f, and puts the output of f into an output NDArray. Index given to f is the full ND index of the element.
minus `operator fun``Matrix``<``Double``>.minus(value:``Int``):``Matrix``<``Double``>`
nIdxToLinear `fun <T>``NDArray``<``T``>.nIdxToLinear(indices:``IntArray``):``Int`
Given a ND index into this array, find the corresponding 1D index in the raw underlying 1D storage array.
plus `operator fun``Matrix``<``Double``>.plus(value:``Int``):``Matrix``<``Double``>`
reshape `fun <T>``Matrix``<``T``>.reshape(rows:``Int``, cols:``Int``):``Matrix``<``T``>`
Returns a new Matrix with the given shape, populated with the data in this array.`fun <T>``NDArray``<``T``>.reshape(vararg dims:``Int``):``NDArray``<``T``>`
Returns a new NDArray with the given shape, populated with the data in this array.
safeNIdxToLinear `fun <T>``NDArray``<``T``>.safeNIdxToLinear(indices:``IntArray``):``Int`
set `operator fun``Matrix``<``Double``>.set(i:``Int``, v:``Double``):``Unit`
`operator fun``Matrix``<``Float``>.set(i:``Int``, v:``Float``):``Unit`
`operator fun <T>``Matrix``<``T``>.set(i:``Int``, v:``T``):``Unit`
`operator fun``Matrix``<``Int``>.set(i:``Int``, v:``Int``):``Unit`
Set the ith element in the matrix. If 2D, selects elements in row-major order.`operator fun``Matrix``<``Double``>.set(i:``Int``, j:``Int``, v:``Double``):``Unit`
`operator fun``Matrix``<``Double``>.set(rows:``IntRange``, cols:``IntRange``, value:``Double``):``Unit`
`operator fun``Matrix``<``Double``>.set(rows:``Int``, cols:``IntRange``, value:``Double``):``Unit`
`operator fun``Matrix``<``Double``>.set(rows:``IntRange``, cols:``Int``, value:``Double``):``Unit`
`operator fun``Matrix``<``Double``>.set(i:``Int``, v:``Int``):``Unit`
`operator fun``Matrix``<``Double``>.set(i:``Int``, j:``Int``, v:``Int``):``Unit`
`operator fun``Matrix``<``Float``>.set(i:``Int``, j:``Int``, v:``Float``):``Unit`
`operator fun``Matrix``<``Float``>.set(rows:``IntRange``, cols:``IntRange``, value:``Float``):``Unit`
`operator fun``Matrix``<``Float``>.set(rows:``Int``, cols:``IntRange``, value:``Float``):``Unit`
`operator fun``Matrix``<``Float``>.set(rows:``IntRange``, cols:``Int``, value:``Float``):``Unit`
`operator fun``Matrix``<``Float``>.set(i:``Int``, v:``Int``):``Unit`
`operator fun``Matrix``<``Float``>.set(i:``Int``, j:``Int``, v:``Int``):``Unit`
`operator fun <T>``Matrix``<``T``>.set(i:``Int``, j:``Int``, v:``T``):``Unit`
`operator fun <T>``Matrix``<``T``>.set(rows:``IntRange``, cols:``IntRange``, value:``T``):``Unit`
`operator fun <T>``Matrix``<``T``>.set(rows:``Int``, cols:``IntRange``, value:``T``):``Unit`
`operator fun <T>``Matrix``<``T``>.set(rows:``IntRange``, cols:``Int``, value:``T``):``Unit`
`operator fun``Matrix``<``Int``>.set(i:``Int``, j:``Int``, v:``Int``):``Unit`
`operator fun``Matrix``<``Int``>.set(rows:``IntRange``, cols:``IntRange``, value:``Int``):``Unit`
`operator fun``Matrix``<``Int``>.set(rows:``Int``, cols:``IntRange``, value:``Int``):``Unit`
`operator fun``Matrix``<``Int``>.set(rows:``IntRange``, cols:``Int``, value:``Int``):``Unit`
`operator fun <T>``NDArray``<``T``>.set(vararg indices:``Int``, value:``NDArray``<``T``>):``Unit`
`operator fun <T>``NDArray``<``T``>.set(vararg indices:``Int``, value:``T``):``Unit``operator fun``Matrix``<``Double``>.set(rows:``IntRange``, cols:``IntRange``, value:``Matrix``<``Double``>):``Unit`
`operator fun``Matrix``<``Float``>.set(rows:``IntRange``, cols:``IntRange``, value:``Matrix``<``Float``>):``Unit`
`operator fun <T>``Matrix``<``T``>.set(rows:``IntRange``, cols:``IntRange``, value:``Matrix``<``T``>):``Unit`
`operator fun``Matrix``<``Int``>.set(rows:``IntRange``, cols:``IntRange``, value:``Matrix``<``Int``>):``Unit`
Allow assignment to a slice, e.g. `matrix[1..2, 3..4]`=something. Note that the range 1..2 is inclusive, so it will retrieve row 1 and 2. Use 1.until(2) for a non-inclusive range.`operator fun``Matrix``<``Double``>.set(rows:``Int``, cols:``IntRange``, value:``Matrix``<``Double``>):``Unit`
`operator fun``Matrix``<``Float``>.set(rows:``Int``, cols:``IntRange``, value:``Matrix``<``Float``>):``Unit`
`operator fun <T>``Matrix``<``T``>.set(rows:``Int``, cols:``IntRange``, value:``Matrix``<``T``>):``Unit`
`operator fun``Matrix``<``Int``>.set(rows:``Int``, cols:``IntRange``, value:``Matrix``<``Int``>):``Unit`
Allow assignment to a slice, e.g. `matrix[2, 3..4]`=something. Note that the range 3..4 is inclusive, so it will retrieve col 3 and 4. Use 1.until(2) for a non-inclusive range.`operator fun``Matrix``<``Double``>.set(rows:``IntRange``, cols:``Int``, value:``Matrix``<``Double``>):``Unit`
`operator fun``Matrix``<``Float``>.set(rows:``IntRange``, cols:``Int``, value:``Matrix``<``Float``>):``Unit`
`operator fun <T>``Matrix``<``T``>.set(rows:``IntRange``, cols:``Int``, value:``Matrix``<``T``>):``Unit`
`operator fun``Matrix``<``Int``>.set(rows:``IntRange``, cols:``Int``, value:``Matrix``<``Int``>):``Unit`
Allow assignment to a slice, e.g. `matrix[1..2, 3]`=something. Note that the range 1..2 is inclusive, so it will retrieve row 1 and 2. Use 1.until(2) for a non-inclusive range.
times `operator fun``Matrix``<``Double``>.times(other:``Int``):``Matrix``<``Double``>`
Multiply a scalar by a matrix
toMatrixOrNull `fun <T>``NDArray``<``T``>.toMatrixOrNull():``Matrix``<``T``>?`
toTypedArray `fun <T>``NDArray``<``T``>.toTypedArray():``Array``<``T``>`
Converts this NDArray into a one-dimensional Array in row-major order.
validate `fun``Matrix``<``Double``>.validate(fn:``ValidationContext``.() ->``Unit``):``Unit`
Use the given fn to validate a matrix. Return either the matrix itself or a copy that has been transformed to match the validation rules.`fun``Matrix``<``Double``>.validate(name:``String``, fn:``ValidationContext``.() ->``Unit``):``Unit`
Use the given fn to validate a matrix with the given name. Return either the matrix itself or a copy that has been transformed to match the validation rules.
widthOfDims `fun <T>``NDArray``<``T``>.widthOfDims():``ArrayList``<``Int``>`

### Inheritors

Name Summary
CBlasMatrix `class CBlasMatrix :``Matrix``<``Double``>,``DoubleMatrixBase`
An implementation of the Matrix interface using raw cblas calls.
DefaultDoubleMatrix `class DefaultDoubleMatrix :``Matrix``<``Double``>`
DefaultFloatMatrix `class DefaultFloatMatrix :``Matrix``<``Float``>`
DefaultIntMatrix `class DefaultIntMatrix :``Matrix``<``Int``>`
EJMLMatrix `class EJMLMatrix :``Matrix``<``Double``>,``DoubleMatrixBase`
An implementation of the Matrix interface using EJML. You should rarely construct this class directly, instead make one via the top-level functions in creators.kt (e.g. zeros(5,5)) or EJMLMatrixFactory.
JBlasMatrix `class JBlasMatrix :``Matrix``<``Double``>,``DoubleMatrixBase`
An implementation of the Matrix interface using jBlas. You should rarely construct this class directly, instead make one via the top-level functions in creators.kt (e.g. zeros(5,5)) or JBlasMatrixFactory.
MTJMatrix `class MTJMatrix :``Matrix``<``Double``>,``DoubleMatrixBase`
An implementation of the Matrix interface using MTJ. You should rarely construct this class directly, instead make one via the top-level functions in creators.kt (e.g. zeros(5,5)) or MTJMatrixFactory.
MatrixBase `abstract class MatrixBase<T> :``Matrix``<``T``>`