public class SparseMatrix<T> extends Object implements Iterable<T>
Modifier and Type | Class and Description |
---|---|
class |
SparseMatrix.SparseMatrixChunk
A public representation of the internal structure of the sparse matrix, i.e.
|
Constructor and Description |
---|
SparseMatrix(int chunkSize,
int totalSize) |
Modifier and Type | Method and Description |
---|---|
T |
get(int x,
int y) |
Iterable<SparseMatrix.SparseMatrixChunk> |
getChunks() |
Iterator<T> |
iterator() |
T |
put(int x,
int y,
T t) |
int |
size() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public SparseMatrix(int chunkSize, int totalSize)
chunkSize
- Must be a power of two so chunk indexes can be determined by shifting off low order bits.
Keep it small (8, 16, 32...). Chunks are square, with this many elements in each of two dimensions,
so the number of elements in each chunk will be the square of this value.totalSize
- Estimated total number of elements to be stored in the matrix (actual use, not capacity).Copyright © 2018. All rights reserved.