invoke

inline operator fun <T> invoke(maxWidth: Int, maxHeight: Int, validator: (Int, Int) -> Boolean, init: (Int, Int) -> T): CompactArrayMutableSparseMatrix<T>

Factory function that creates and initializes a compact mutable sparse matrix. maxWidth and maxHeight are used for the underlying array dimensions. The validator will be called exactly once for each coordinate. If it returns true the init function is called to determine the initial value.

Parameters

maxWidth

The maximum width allowed in the matrix

maxHeight

The maximum height allowed in the matrix

validator

Function that determines whether a particular location is valid or not.

init

Function that determines the initial value for a location.


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

Factory function that creates and initializes a compact mutable sparse matrix. maxWidth and maxHeight are used for the underlying array dimensions. This variant uses a sealed return type to determine whether a value is sparse or not.

Parameters

maxWidth

The maximum width allowed in the matrix

maxHeight

The maximum height allowed in the matrix

init

Function that determines the initial value for a location.