public class SparseMatrix extends MutableAbstractMatrix
buffer, columns, rows, zeroPadded
Constructor and Description |
---|
SparseMatrix(int rows,
int columns)
Creates a sparse matrix with the given dimensions.
|
SparseMatrix(int rows,
int columns,
boolean zeroPadded)
Creates a sparse matrix with the given dimensions.
|
Modifier and Type | Method and Description |
---|---|
protected void |
allocate(MatrixBackingBuffer buffer)
Calls
MatrixBackingBuffer.allocate(int) on the used buffer. |
float |
get(int row,
int column)
Gets the value from
row and column . |
void |
set(int row,
int column,
float value)
Sets the given value.
|
float |
sum()
Compute the sum of all elements.
|
String |
toString() |
copy, copy, copy, copy, fill, set, setColumn, setRow
add, checkBounds, columnSum, enlarge, equals, get, getColumn, getNumberOfColumns, getNumberOfRows, getRow, hadamardMultiply, hashCode, isInvalid, isValidXORZeroPadded, isZeroPadded, multiply, multiply, rowSum, subtract, toIndex, translate, transpose
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, columnSum, enlarge, getColumn, getNumberOfColumns, getNumberOfRows, getRow, hadamardMultiply, isZeroPadded, multiply, multiply, rowSum, subtract, translate, transpose
public SparseMatrix(int rows, int columns, boolean zeroPadded)
rows
- number of rowscolumns
- number of columnszeroPadded
- zero-pad or not?public SparseMatrix(int rows, int columns)
rows
- number of rowscolumns
- number of columnspublic float get(int row, int column)
Matrix
row
and column
.
If the matrix supports zero-padding, this method may return
0f
for undefined rows or columns.get
in interface Matrix
get
in class AbstractMatrix
row
- rowcolumn
- columnpublic void set(int row, int column, float value)
MutableMatrix
set
in interface MutableMatrix
set
in class MutableAbstractMatrix
row
- rowcolumn
- columnvalue
- valueprotected void allocate(MatrixBackingBuffer buffer)
MutableAbstractMatrix
MatrixBackingBuffer.allocate(int)
on the used buffer.allocate
in class MutableAbstractMatrix
buffer
- bufferpublic float sum()
Matrix
sum
in interface Matrix
sum
in class AbstractMatrix
public String toString()
toString
in class AbstractMatrix
Copyright © 2011–2020 tagtraum industries incorporated. All rights reserved.