public class FMatrixSparseTriplet extends java.lang.Object implements FMatrixSparse
| Modifier and Type | Class and Description |
|---|---|
static class |
FMatrixSparseTriplet.Element |
| Modifier and Type | Field and Description |
|---|---|
int |
numCols |
int |
numRows |
FMatrixSparseTriplet.Element[] |
nz_data |
int |
nz_length |
| Constructor and Description |
|---|
FMatrixSparseTriplet() |
FMatrixSparseTriplet(FMatrixSparseTriplet orig) |
FMatrixSparseTriplet(int numRows,
int numCols,
int initLength) |
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(int row,
int col,
float value) |
<T extends Matrix> |
copy()
Creates an exact copy of the matrix
|
<T extends Matrix> |
createLike()
Creates a new matrix with the same shape as this matrix
|
float |
get(int row,
int col)
Returns the value of value of the specified matrix element.
|
int |
getLength() |
int |
getNumCols()
Returns the number of columns in this matrix.
|
int |
getNumElements()
Returns the number of elements in this matrix, which is the number of rows
times the number of columns.
|
int |
getNumRows()
Returns the number of rows in this matrix.
|
MatrixType |
getType()
Returns the type of matrix
|
void |
growData(int max_nz_length)
Will resize the array and keep all the old data
|
boolean |
isAssigned(int row,
int col)
Is the specified element explicitly assigned a value
|
int |
nz_index(int row,
int col) |
void |
print()
Prints the matrix to standard out.
|
void |
printNonZero()
Prints to standard out the non-zero elements only.
|
void |
remove(int row,
int col)
If the specified element is non-zero it is removed from the structure
|
void |
reset() |
void |
reshape(int numRows,
int numCols) |
void |
reshape(int numRows,
int numCols,
int arrayLength)
Reshapes the matrix so that it can store a matrix with the specified dimensions and the number of
non-zero elements.
|
void |
set(int row,
int col,
float value)
Sets the value of the specified matrix element.
|
void |
set(Matrix original)
Sets this matrix to be identical to the 'original' matrix passed in.
|
void |
shrinkArrays()
Reduces the size of internal data structures to their minimal size.
|
float |
unsafe_get(int row,
int col)
Same as
FMatrix.get(int, int) but does not perform bounds check on input parameters. |
void |
unsafe_set(int row,
int col,
float value)
Same as
FMatrix.set(int, int, float) but does not perform bounds check on input parameters. |
void |
zero()
Sets all elements to zero by removing the sparse graph
|
public FMatrixSparseTriplet.Element[] nz_data
public int nz_length
public int numRows
public int numCols
public FMatrixSparseTriplet()
public FMatrixSparseTriplet(int numRows,
int numCols,
int initLength)
numRows - Number of rows in the matrixnumCols - Number of columns in the matrixinitLength - Initial maximum length of data array.public FMatrixSparseTriplet(FMatrixSparseTriplet orig)
public void reset()
public void reshape(int numRows,
int numCols)
public void reshape(int numRows,
int numCols,
int arrayLength)
FMatrixSparsereshape in interface FMatrixSparsenumRows - number of rowsnumCols - number of columnsarrayLength - Array length for storing non-zero elements.public void addItem(int row,
int col,
float value)
public void set(int row,
int col,
float value)
FMatrixpublic void unsafe_set(int row,
int col,
float value)
FMatrixFMatrix.set(int, int, float) but does not perform bounds check on input parameters. This results in about a 25%
speed increase but potentially sacrifices stability and makes it more difficult to track down simple errors.
It is not recommended that this function be used, except in highly optimized code where the bounds are
implicitly being checked.unsafe_set in interface FMatrixrow - Matrix element's row index..col - Matrix element's column index.value - The element's new value.public int getNumElements()
FMatrixgetNumElements in interface FMatrixpublic float get(int row,
int col)
FMatrixpublic float unsafe_get(int row,
int col)
FMatrixFMatrix.get(int, int) but does not perform bounds check on input parameters. This results in about a 25%
speed increase but potentially sacrifices stability and makes it more difficult to track down simple errors.
It is not recommended that this function be used, except in highly optimized code where the bounds are
implicitly being checked.unsafe_get in interface FMatrixrow - Matrix element's row index..col - Matrix element's column index.public int nz_index(int row,
int col)
public void growData(int max_nz_length)
max_nz_length - New maximum length of datapublic int getLength()
public int getNumRows()
MatrixgetNumRows in interface Matrixpublic int getNumCols()
MatrixgetNumCols in interface Matrixpublic <T extends Matrix> T copy()
Matrixpublic <T extends Matrix> T createLike()
MatrixcreateLike in interface Matrixpublic void set(Matrix original)
Matrixpublic void shrinkArrays()
FMatrixSparseshrinkArrays in interface FMatrixSparsepublic void remove(int row,
int col)
FMatrixSparseremove in interface FMatrixSparserow - the rowcol - the columnpublic boolean isAssigned(int row,
int col)
FMatrixSparseisAssigned in interface FMatrixSparserow - the rowcol - the columnpublic void zero()
FMatrixSparsezero in interface FMatrixSparsepublic void print()
Matrixpublic void printNonZero()
FMatrixSparseprintNonZero in interface FMatrixSparsepublic MatrixType getType()
Matrix