Companion

object Companion

The companion object contains factory functions to create new instances with initialization.

Functions

Link copied to clipboard
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.

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.