Companion

object Companion : ImmutableSparseMatrixCompanion<Any?>

The companion object contains factory functions to create new instances. There is no guarantee as to the specific type returned for the interface (but always an instance of SparseMatrix).

Functions

Link copied to clipboard

Create a sparse matrix from the given matrix with special SparseValue instances that indicate either a value or sparseness.

Link copied to clipboard
open fun <T> function(maxWidth: Int, maxHeight: Int, valueFun: SparseMatrix.SparseInit<T>.(Int, Int) -> SparseMatrix.SparseValue<T>): SparseMatrix<T>

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

open fun <T> function(maxWidth: Int, maxHeight: Int, validator: (Int, Int) -> Boolean, valueFun: (Int, Int) -> T): SparseMatrix<T>

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

Link copied to clipboard
open operator override fun <T> invoke(original: SparseMatrix<T>): SparseMatrix<T>

Create a copy of the parameter using the copyOf member function.

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

Create a sparse matrix with given maximum X and Y that is initialized using the given "constructor" function. This function invokes the initializer on construction only.

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

Create a sparse matrix that has the given maximum X and Y values, is initialized with the parameter value, and uses the function to determine whether the cell exists. The returned matrix is immutable, but the validator is not required to always return the same value.

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

Create a sparse matrix that has the given maximum X and Y values, has the given validator to determine sparseness and uses the given function to initialize the matrix (values set on construction).