public class BMatrixRMaj extends java.lang.Object implements ReshapeMatrix
Modifier and Type | Field and Description |
---|---|
boolean[] |
data
1D row-major array for storing theboolean matrix
|
int |
numCols
Number of columns in the matrix.
|
int |
numRows
Number of rows in the matrix.
|
Constructor and Description |
---|
BMatrixRMaj(int numRows,
int numCols) |
Modifier and Type | Method and Description |
---|---|
<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
|
void |
fill(boolean value)
Sets every element in the matrix to the specified value
|
boolean |
get(int index) |
boolean |
get(int row,
int col) |
int |
getIndex(int row,
int col) |
int |
getNumCols()
Returns the number of columns in this matrix.
|
int |
getNumElements() |
int |
getNumRows()
Returns the number of rows in this matrix.
|
MatrixType |
getType()
Returns the type of matrix
|
boolean |
isInBounds(int row,
int col)
Determines if the specified element is inside the bounds of the Matrix.
|
void |
print()
Prints the matrix to standard out.
|
void |
reshape(int numRows,
int numCols)
Equivalent to invoking reshape(numRows,numCols,false);
|
void |
set(int row,
int col,
boolean value) |
void |
set(Matrix original)
Sets this matrix to be identical to the 'original' matrix passed in.
|
int |
sum()
Returns the total number of elements which are true.
|
boolean |
unsafe_get(int row,
int col) |
void |
unsafe_set(int row,
int col,
boolean value) |
public boolean[] data
public int numRows
public int numCols
public int getNumElements()
public int getIndex(int row, int col)
public void fill(boolean value)
value
- new value of every elementpublic boolean get(int index)
public boolean get(int row, int col)
public void set(int row, int col, boolean value)
public boolean unsafe_get(int row, int col)
public void unsafe_set(int row, int col, boolean value)
public boolean isInBounds(int row, int col)
row
- The element's row.col
- The element's column.public int sum()
public void reshape(int numRows, int numCols)
ReshapeMatrix
reshape
in interface ReshapeMatrix
numRows
- The new number of rows in the matrix.numCols
- The new number of columns in the matrix.public int getNumRows()
Matrix
getNumRows
in interface Matrix
public int getNumCols()
Matrix
getNumCols
in interface Matrix
public <T extends Matrix> T copy()
Matrix
public void set(Matrix original)
Matrix
public void print()
Matrix
public <T extends Matrix> T createLike()
Matrix
createLike
in interface Matrix
public MatrixType getType()
Matrix