MatrixFactory

matr.MatrixFactory
See theMatrixFactory companion object
trait MatrixFactory[R <: Int, C <: Int, T](using x$1: ValueOf[R], x$2: ValueOf[C], x$3: Numeric[T])

Central entry point for creating Matrices. Modules implementing the Matrix trait should also provide an instance of this type class.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def builder: Builder[R, C, T]

Returns a fresh Matrix.Builder instance.

Returns a fresh Matrix.Builder instance.

Attributes

Concrete methods

def fromTuple[MatrixTuple <: Tuple, RowTuple <: Tuple](matrixTuple: MatrixTuple)(using MatrixTupleReader[MatrixTuple, RowTuple], RowTupleReader[RowTuple, T], Size[MatrixTuple] =:= R, Size[RowTuple] =:= C): Matrix[R, C, T]

Creates a Matrix with the specified elements that are structured row by row from tuples.

Creates a Matrix with the specified elements that are structured row by row from tuples.

Dimensions will be checked at compile-time.

When invoking this method the following import has to be in place:

import matr.TupleSupport.given

The creation of i.e. a 2x3 Matrix looks like this:

val m = MatrixFactory[2, 3, Int].fromTuple(
 (11, 12, 13),
 (21, 22, 23)
)

Attributes

def identity(using IsSquare[R, C]): Matrix[R, C, T]

Creates the identity Matrix.

Creates the identity Matrix.

Attributes

def ones: Matrix[R, C, T]

Creates a Matrix of ones.

Creates a Matrix of ones.

Attributes

def rowMajor(elements: T*): Matrix[R, C, T]

Creates a Matrix containing the specified elements, assuming row-major order. Dimensions will be checked at runtime.

Creates a Matrix containing the specified elements, assuming row-major order. Dimensions will be checked at runtime.

Attributes

def tabulate(fillElem: (Int, Int) => T): Matrix[R, C, T]

Creates a Matrix containing the elements returned by the specified function.

Creates a Matrix containing the elements returned by the specified function.

Value parameters

fillElem

function returning the element at the specified position (row index, column index)

Attributes

def zeros: Matrix[R, C, T]

Creates a Matrix of zeros.

Creates a Matrix of zeros.

Attributes