invoke

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

Create a new SparseMatrix that is a copy of the original.

Return

The copy (from copyOf), depending on the type this may be the same object as the original.


Create a new matrix that is a copy of the original

Parameters

source

The source for the matrix data


open operator override fun <T : Boolean> invoke(maxWidth: Int, maxHeight: Int, init: SparseMatrix.SparseInit<T>.(Int, Int) -> SparseMatrix.SparseValue<T>): SparseMatrix<T>

Create a new SparseMatrix with the given size and intialization function. The initialization function

Parameters

maxWidth

The width of the matrix

maxHeight

The height of the matrix

init

An initialization function that sets the values for the matrix.


inline operator fun invoke(maxWidth: Int, maxHeight: Int, init: SparseMatrix.SparseInit<Boolean>.(Int, Int) -> SparseMatrix.SparseValue<Boolean>): SparseBooleanMatrix

Create a SparseBooleanMatrix initialized with the given value

Parameters

maxWidth

Width of the matrix

maxHeight

Height of the matrix

init

The function initializing the matrix


open operator override fun <T : Boolean> invoke(maxWidth: Int, maxHeight: Int, initValue: T, validator: (Int, Int) -> Boolean): SparseMatrix<T>

Create a new SparseMatrix with the given size and intialization function. It also requires a validate function

Return

The resulting matrix.

Parameters

maxWidth

The width of the matrix

maxHeight

The height of the matrix

initValue

A value for the non-sparse elements of the matrix

validator

A function that is used to determine whether a particular coordinate is contained in the matrix.


operator fun invoke(maxWidth: Int, maxHeight: Int, initValue: Boolean, validator: (Int, Int) -> Boolean): SparseBooleanMatrix

Create a SparseBooleanMatrix initialized with the given value

Parameters

maxWidth

Width of the matrix

maxHeight

Height of the matrix

initValue

The value of all cells

validator

The function that determines whether a given cell is valid.


open inline operator override fun <T : Boolean> invoke(maxWidth: Int, maxHeight: Int, noinline validator: (Int, Int) -> Boolean, init: (Int, Int) -> T): SparseMatrix<T>

Create a new SparseMatrix with the given size and intialization function. It also requires a validate function

Return

The resulting matrix.

Parameters

maxWidth

The width of the matrix

maxHeight

The height of the matrix

validator

A function that is used to determine whether a particular coordinate is contained in the matrix.

init

An initialization function that sets the values for the matrix.


inline operator fun invoke(maxWidth: Int, maxHeight: Int, noinline validator: (Int, Int) -> Boolean, init: (Int, Int) -> Boolean): SparseBooleanMatrix

Create a SparseBooleanMatrix initialized with the given value

Parameters

maxWidth

Width of the matrix

maxHeight

Height of the matrix

init

The function initializing the matrix

validator

The function that determines whether a given cell is valid.