Builder

matr.Matrix.Builder
trait Builder[R <: Int, C <: Int, T] extends Matrix[R, C, T]

A Builder is a "Matrix under construction" that itself forms a (mutable) Matrix. Utilizing Builder is the preferred way of creating new Matrices in Matrix operations.

Modules implementing the Matrix trait should also provide an implementation of this trait.

Invoking the same Builder instance multiple times is OK, but letting a Builder leave the local scope is not OK (it's mutable!).

Implementations of this trait must return zero for uninitialized element positions.

Attributes

Graph
Supertypes
trait Matrix[R, C, T]
class Object
trait Matchable
class Any

Members list

Type members

Inherited types

type This = Matrix[R, C, T]

Convenience type alias for this Matrix.

Convenience type alias for this Matrix.

Attributes

Inherited from:
Matrix

Value members

Abstract methods

def result: Matrix[R, C, T]

Creates the Matrix resulting from this Builder.

Creates the Matrix resulting from this Builder.

Attributes

def update(rowIdx: Int, colIdx: Int, v: T): this.type

Sets the specified element at the specified position.

Sets the specified element at the specified position.

Attributes

Inherited methods

final def +(rhs: This)(using ma: MatrixAddition[R, C, T]): This

Performs a Matrix Addition.

Performs a Matrix Addition.

Attributes

Inherited from:
Matrix
final def -(rhs: This)(using ms: MatrixSubtraction[R, C, T]): This

Performs a Matrix Subtraction.

Performs a Matrix Subtraction.

Attributes

Inherited from:
Matrix
final def ===(rhs: This)(using me: MatrixEquality[R, C, T]): Boolean

Checks the equality of this and the other Matrix by performing element-wise comparision.

Checks the equality of this and the other Matrix by performing element-wise comparision.

Attributes

Returns

true if both Matrices are equal

Inherited from:
Matrix
def apply[RowIdx <: Int, ColIdx <: Int](using ValueOf[RowIdx], ValueOf[ColIdx], PositionWithinShape[RowIdx, ColIdx, R, C]): T

Returns the element at the index specified at compile-time.

Returns the element at the index specified at compile-time.

Type parameters

ColIdx

column index

RowIdx

row index

Attributes

Inherited from:
Matrix
final def colDim: Int

Returns the column dimension.

Returns the column dimension.

Attributes

Inherited from:
Matrix
def combine[U, V](rhs: Matrix[R, C, U])(op: (T, U) => V)(using MatrixFactory[R, C, V]): Matrix[R, C, V]

Combines this Matrix and the other Matrix by applying the specified operation on the respective corresponding elements.

Combines this Matrix and the other Matrix by applying the specified operation on the respective corresponding elements.

Attributes

Inherited from:
Matrix
final def det(using d: Determinant[R, C, T]): T

Returns the determinant of this Matrix. Requires that this Matrix is a squared Matrix.

Returns the determinant of this Matrix. Requires that this Matrix is a squared Matrix.

Attributes

Inherited from:
Matrix
final infix def dot[L <: Int, U, X](rhs: Matrix[C, L, U])(using mm: MatrixMultiplication[R, C, L, T, U, X]): mm.Out

Performs a Matrix Multiplication by calculating the dot product.

Performs a Matrix Multiplication by calculating the dot product.

Attributes

Inherited from:
Matrix
def fold[S](start: S)(op: (S, Int, Int) => S): S

Folds over the elements of this Matrix by invoking the specified operation with each element's index and the result of the previous invocation.

Folds over the elements of this Matrix by invoking the specified operation with each element's index and the result of the previous invocation.

Value parameters

op

operation applied to each element (index)

start

value provided to the first invocation

Attributes

Returns

result of the last invocation of the specified operation

Inherited from:
Matrix
final def inv(using i: Inverse[R, C, T]): This

Returns the inverse of this Matrix. Requires that this Matrix is a squared Matrix.

Returns the inverse of this Matrix. Requires that this Matrix is a squared Matrix.

Attributes

Inherited from:
Matrix
def iterate(op: (Int, Int) => Unit): Unit

Iterates over this Matrix by invoking the specified operation with each element's index.

Iterates over this Matrix by invoking the specified operation with each element's index.

Attributes

Inherited from:
Matrix
def map[U](op: T => U)(using MatrixFactory[R, C, U]): Matrix[R, C, U]

Maps this Matrix to a new Matrix by applying the specified operation element-wise.

Maps this Matrix to a new Matrix by applying the specified operation element-wise.

Attributes

Inherited from:
Matrix
def mkString(elemToString: T => String): String

Renders this Matrix to a String using the specified function.

Renders this Matrix to a String using the specified function.

Attributes

Inherited from:
Matrix
def mkString: String

Renders this Matrix to a String using the elements' toString method.

Renders this Matrix to a String using the elements' toString method.

Attributes

Inherited from:
Matrix
def modify(using MatrixFactory[R, C, T]): Builder[R, C, T]

Allows to easily "modify" this Matrix by creating a Builder initialized with the values of this Matrix.

Allows to easily "modify" this Matrix by creating a Builder initialized with the values of this Matrix.

Attributes

Inherited from:
Matrix
final def rowDim: Int

Returns the row dimension.

Returns the row dimension.

Attributes

Inherited from:
Matrix
final def submatrix[RowIdxTL <: Int, ColIdxTL <: Int, RowIdxBR <: Int, ColIdxBR <: Int](using sub: Submatrix[RowIdxTL, ColIdxTL, RowIdxBR, ColIdxBR, R, C, T]): Matrix[(RowIdxBR - RowIdxTL) + 1, (ColIdxBR - ColIdxTL) + 1, T]

Returns the submatrix with the specified bounds.

Returns the submatrix with the specified bounds.

Type parameters

ColIdxBR

column index of the bottom-right vertex

ColIdxTL

column index of the top-left vertex

RowIdxBR

row index of the bottom-right vertex

RowIdxTL

row index of the top-left vertex

Attributes

Inherited from:
Matrix
final def transpose(using mt: Transpose[R, C, T]): Matrix[C, R, T]

Returns the transposed Matrix.

Returns the transposed Matrix.

Attributes

Inherited from:
Matrix

Inherited and Abstract methods

def apply(rowIdx: Int, colIdx: Int): T

Returns the element at the index specified at runtime.

Returns the element at the index specified at runtime.

Value parameters

colIdx

column index

rowIdx

row index

Attributes

Inherited from:
Matrix