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