Matrix¶
Class and companion object for dense matrices on the CPU.
Constructor
The following syntax is available for constructing Matrix instances from indexed functions:
(0::16, 0::32){(i,j) => func(i,j) }
This returns a Matrix with 16 rows and 32 columns, with elements defined by func(i,j). More general Range forms can also be used, including strided (e.g. 0::2::8) and offset (e.g. 32::64). The iterators i and j will iterate over all values in their respective ranges.
Static methods
object Matrix | |
---|---|
Infix methods
class Matrix | |
---|---|
def rows: Index
Returns the number of rows in this Matrix.
|
|
def cols: Index
Returns the number of columns in this Matrix.
|
|
def reduce(rfunc: (T,T) => T): T
Reduces the elements in this Matrix into a single element using associative function rfunc.
|
|
def transpose(): Matrix[T] = (0::cols, 0::rows){(j, i)
Returns the transpose of this Matrix.
|