Companion

object Companion : MutableSparseMatrixCompanion<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 MutableSparseMatrix).

Functions

Link copied to clipboard

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

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

Create a copy of the original matrix. Note that the returned type may differ depending on the type of the parameter. In particular if the parameter is an instance of Matrix the returned type is a MutableMatrix instance.

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

Create a mutable 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): MutableSparseMatrix<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.

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

Create a mutable 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).