Compact Array Mutable Sparse Matrix
Implementation of a MutableSparseMatrix based upon an array to store data and validity. It uses the same array to record sparseness as well as data. It does not support changing validity of cells (at this point).
Constructors
Create a new instance of the class with the given validation function. All elements of the matrix will be set to the same initial value. The validation function does not need to validate that the coordinate is within
Create a new instance that is a copy of the original matrix. This will be a shallow copy as in the elements will not be copied.
A constructor that creates a new CompactArrayMutableSparseMatrix given a matrix of SparseValues. Those are used to initialize the matrix.
Types
Functions
Get all elements in the matrix as sequence.
Determine whether the content of this matrix is the same as the other by checking equality on the cell values. Sparse matrices with different dimensions, but the same valid indices can be equal.
Create a copy of this matrix
Helper function to set values into a MutableSparseMatrix.
Perform the action for each index in the (sparse) matrix. This skips sparse indices.
Determine whether a given coordinate is valid for the matrix.
This function can be used to determine whether the given coordinates are valid. Returns true if valid. This function works on any value for the coordinates and should return false
for all values out of range (x<0 || x>=[maxWidth]
), (y<0 || y>=[maxHeight]
).
A map implementation that creates a boolean sparse matrix based upon the receiver and the transformation function.
Create a new SparseIntMatrix with the dimensions of the original where the value of each cell is the result of applying the transform to the value of the cell in the original.