public class SparseRowMatrix extends MutableAbstractMatrix
Matrix.getRow(int)
runs much more quickly than Matrix.getColumn(int).
The same is true for MutableMatrix.setRow(int, float[]) and its column
counterpart.buffer, columns, rows, zeroPadded| Constructor and Description |
|---|
SparseRowMatrix(int rows,
int columns)
Creates a sparse matrix with the given dimensions.
|
SparseRowMatrix(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[] |
columnSum()
Compute the sum for each column.
|
float |
get(int row,
int column)
Gets the value from
row and column. |
float[] |
getRow(int row)
Gets the values from
row. |
float[] |
rowSum()
Compute the sum for each row.
|
void |
set(int row,
int column,
float value)
Sets the given value.
|
void |
setRow(int row,
float[] values)
Sets the given values.
|
float |
sum()
Compute the sum of all elements.
|
String |
toString() |
copy, copy, copy, copy, fill, set, setColumnadd, checkBounds, enlarge, equals, get, getColumn, getNumberOfColumns, getNumberOfRows, hadamardMultiply, hashCode, isInvalid, isValidXORZeroPadded, isZeroPadded, multiply, multiply, subtract, toIndex, translate, transposeclone, finalize, getClass, notify, notifyAll, wait, wait, waitadd, enlarge, getColumn, getNumberOfColumns, getNumberOfRows, hadamardMultiply, isZeroPadded, multiply, multiply, subtract, translate, transposepublic SparseRowMatrix(int rows,
int columns,
boolean zeroPadded)
rows - number of rowscolumns - number of columnszeroPadded - zero-pad or not?public SparseRowMatrix(int rows,
int columns)
rows - number of rowscolumns - number of columnspublic float get(int row,
int column)
Matrixrow and column.
If the matrix supports zero-padding, this method may return
0f for undefined rows or columns.get in interface Matrixget in class AbstractMatrixrow - rowcolumn - columnpublic float[] getRow(int row)
Matrixrow.
If the matrix supports zero-padding, this method may return
0f for undefined rows or columns.getRow in interface MatrixgetRow in class AbstractMatrixrow - rowpublic void set(int row,
int column,
float value)
MutableMatrixset in interface MutableMatrixset in class MutableAbstractMatrixrow - rowcolumn - columnvalue - valuepublic void setRow(int row,
float[] values)
MutableMatrixsetRow in interface MutableMatrixsetRow in class MutableAbstractMatrixrow - rowvalues - valuespublic float sum()
Matrixsum in interface Matrixsum in class AbstractMatrixpublic float[] rowSum()
MatrixrowSum in interface MatrixrowSum in class AbstractMatrixpublic float[] columnSum()
MatrixcolumnSum in interface MatrixcolumnSum in class AbstractMatrixprotected void allocate(MatrixBackingBuffer buffer)
MutableAbstractMatrixMatrixBackingBuffer.allocate(int) on the used buffer.allocate in class MutableAbstractMatrixbuffer - bufferpublic String toString()
toString in class AbstractMatrixCopyright © 2011–2020 tagtraum industries incorporated. All rights reserved.