invoke

open operator override fun <T : Boolean> invoke(original: Matrix<T>): Matrix<T>

Create a new matrix that is a copy of the original. The copy is a shallow copy.

Parameters

original

the matrix to copy (dimensions and content).


operator fun invoke(source: Matrix<Boolean>): BooleanMatrix
operator fun invoke(source: BooleanMatrix): BooleanMatrix


open operator override fun <T : Boolean> invoke(width: Int, height: Int, initValue: T): Matrix<T>

Create a new matrix with the given dimensions and initial value. Note that this function is provided for concistency on Matrix, but SingleValueMatrix is recommended for the usecase.

Parameters

width

The width of the matrix to create

height

The height of the matrix to create

initValue

The initial value of each cell (this is also the actual value for read-only matrices)


operator fun invoke(width: Int, height: Int, initValue: Boolean): BooleanMatrix

Create an BooleanMatrix initialized with the given value

Parameters

width

Width of the matrix

height

Height of the matrix

initValue

The value of all cells


open inline operator override fun <T : Boolean> invoke(width: Int, height: Int, init: (Int, Int) -> T): Matrix<T>

Create a new matrix with the given dimensions and initialised using the init function.

Parameters

width

The width of the matrix to create

height

The height of the matrix to create

init

The function that determines the initial value for each function


inline operator fun invoke(width: Int, height: Int, init: (Int, Int) -> Boolean): BooleanMatrix

Create an BooleanMatrix initialized according to the init function.

Parameters

width

Width of the matrix

height

Height of the matrix

init

Function used to initialise each cell.