Companion

object Companion : MutableSparseMatrixCompanion<Int>

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

Functions

Link copied to clipboard

Factory unction to create an instance based upon the matrix of SparseValues as initializers. This is not an invoke operator due to overloading issues.

Link copied to clipboard

Create a new mutable matrix initialized from the source.

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

Create a MutableIntMatrix initialized with the default value of the Int type (0)

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

Factory function that creates and initializes a (readonly) MutableSparseIntMatrix. 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 invoke(maxWidth: Int, maxHeight: Int, init: SparseMatrix.SparseInit<Int>.(Int, Int) -> SparseMatrix.SparseValue<Int>): MutableSparseIntMatrix

Create a SparseIntMatrix initialized with the given value

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

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

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

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

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

Create a MutableSparseIntMatrix initialized with the given value