E
- type for this sparse 3D matrixpublic class SparseMatrix3D<E> extends AbstractMatrix3D<E> implements Serializable
Long
s.
The cardinality of this sparse object matrix is limited
by the HashMap
underlying this implementation
to something less than Integer.MAX_VALUE
. The
addressable size, on the other hand, is limited to
(slices * rows * columns) < Long.MAX_VALUE
.
columns, columnStride, columnZero, isView, rows, rowStride, rowZero, slices, sliceStride, sliceZero
Modifier | Constructor and Description |
---|---|
|
SparseMatrix3D(long slices,
long rows,
long columns)
Create a new sparse 3D matrix with the specified number
of slices, rows, and columns.
|
|
SparseMatrix3D(long slices,
long rows,
long columns,
int initialCapacity,
float loadFactor)
Create a new sparse 3D matrix with the specified number
of slices, rows, and columns, initial capacity, and load factor.
|
protected |
SparseMatrix3D(long slices,
long rows,
long columns,
long sliceZero,
long rowZero,
long columnZero,
long sliceStride,
long rowStride,
long columnStride,
boolean isView,
Map<Long,E> elements)
Create a new instance of SparseMatrix3D with the specified
number of slices, rows, and columns and map of elements.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear all the values in this 3D matrix (optional operation).
|
Object |
clone() |
protected Map<Long,E> |
elements()
Return a reference to the map backing this sparse 3D matrix.
|
void |
forEachNonNull(UnaryProcedure<? super E> procedure)
Apply the specified procedure to each non-null value in this 3D matrix.
|
E |
getQuick(long slice,
long row,
long column)
Return the value at the specified slice, row, and column without
checking bounds.
|
void |
setQuick(long slice,
long row,
long column,
E e)
Set the value at the specified slice, row, and column to
e without checking bounds (optional operation). |
String |
toString() |
Matrix2D<E> |
viewColumn(long column)
Return a new 2D matrix slice view of the specified column.
|
Matrix2D<E> |
viewRow(long row)
Return a new 2D matrix slice view of the specified row.
|
Matrix2D<E> |
viewSlice(long slice)
Return a new 2D matrix slice view of the specified slice.
|
aggregate, aggregate, assign, assign, assign, assign, cardinality, columns, columnStride, columnZero, forEach, forEach, forEach, forEach, get, isEmpty, isView, iterator, rows, rowStride, rowZero, set, size, slices, sliceStride, sliceZero, vColumnFlip, vDice, view, viewColumnFlip, viewDice, viewPart, viewRowFlip, viewSelection, viewSelection, viewSelection, viewSliceFlip, viewStrides, vPart, vRowFlip, vSliceFlip, vStrides
public SparseMatrix3D(long slices, long rows, long columns)
slices
- slices, must be >= 0
rows
- rows, must be >= 0
columns
- columns, must be >= 0
IllegalArgumentException
- if any of slices
,
rows
, or columns
is negativepublic SparseMatrix3D(long slices, long rows, long columns, int initialCapacity, float loadFactor)
slices
- slices, must be >= 0
rows
- rows, must be >= 0
columns
- columns, must be >= 0
initialCapacity
- initial capacity, must be >= 0
loadFactor
- load factor, must be > 0
protected SparseMatrix3D(long slices, long rows, long columns, long sliceZero, long rowZero, long columnZero, long sliceStride, long rowStride, long columnStride, boolean isView, Map<Long,E> elements)
clone()
method.slices
- slices, must be >= 0
rows
- rows, must be >= 0
columns
- columns, must be >= 0
sliceZero
- slice of the first elementrowZero
- row of the first elementcolumnZero
- column of the first elementsliceStride
- number of slices between two elementsrowStride
- number of rows between two elementscolumnStride
- number of columns between two elementsisView
- true if this instance is a viewelements
- map of elementspublic E getQuick(long slice, long row, long column)
getQuick
in interface Matrix3D<E>
slice
- slice index, should be >= 0
and < slices()
(unchecked)row
- row index, should be >= 0
and < rows()
(unchecked)column
- column index, should be >= 0
and < columns()
(unchecked)public void setQuick(long slice, long row, long column, E e)
e
without checking bounds (optional operation).setQuick
in interface Matrix3D<E>
setQuick
in class AbstractMatrix3D<E>
slice
- slice index, should be >= 0
and < slices()
(unchecked)row
- row index, should be >= 0
and < rows()
(unchecked)column
- column index, should be >= 0
and < columns()
(unchecked)e
- valuepublic void clear()
public void forEachNonNull(UnaryProcedure<? super E> procedure)
For example:
Matrix3D<String> m; m.forEachNonNull(new UnaryProcedure<String>() { public void run(final String value) { System.out.println(value); } });Overridden for performance.
forEachNonNull
in interface Matrix3D<E>
forEachNonNull
in class AbstractMatrix3D<E>
procedure
- procedure, must not be nullpublic Matrix2D<E> viewSlice(long slice)
public Matrix2D<E> viewRow(long row)
public Matrix2D<E> viewColumn(long column)
viewColumn
in interface Matrix3D<E>
column
- column index, must be >= 0
and < columns()
protected Map<Long,E> elements()
Copyright (c) 2004-2013 held jointly by the individual authors. Licensed under the GNU Lesser General Public License (LGPL).