Package org.ejml.data
Class BMatrixRMaj
java.lang.Object
org.ejml.data.BMatrixRMaj
- All Implemented Interfaces:
Serializable
,Matrix
,ReshapeMatrix
Dense matrix composed of boolean values
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T extends Matrix>
Tcopy()
Creates an exact copy of the matrixcreate
(int numRows, int numCols) Creates a new matrix of the same type with the specified shapeCreates a new matrix with the same shape as this matrixvoid
fill
(boolean value) Sets every element in the matrix to the specified valueboolean
get
(int index) boolean
get
(int row, int col) int
getIndex
(int row, int col) int
Returns the number of columns in this matrix.int
int
Returns the number of rows in this matrix.getType()
Returns the type of matrixboolean
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 using standard formatting.void
Prints the matrix to standard out with the specified formatting.void
reshape
(int numRows, int numCols) Equivalent to invoking reshape(numRows,numCols,false);void
set
(int row, int col, boolean value) void
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) void
zero()
Sets all values inside the matrix to zero
-
Field Details
-
data
public boolean[] data1D row-major array for storing theboolean matrix -
numRows
public int numRowsNumber of rows in the matrix. -
numCols
public int numColsNumber of columns in the matrix.
-
-
Constructor Details
-
BMatrixRMaj
public BMatrixRMaj(int numRows, int numCols)
-
-
Method Details
-
getNumElements
public int getNumElements() -
getIndex
public int getIndex(int row, int col) -
fill
public void fill(boolean value) Sets every element in the matrix to the specified value- Parameters:
value
- new value of every element
-
get
public boolean get(int index) -
get
public boolean get(int row, int col) -
set
public void set(int row, int col, boolean value) -
unsafe_get
public boolean unsafe_get(int row, int col) -
unsafe_set
public void unsafe_set(int row, int col, boolean value) -
isInBounds
public boolean isInBounds(int row, int col) Determines if the specified element is inside the bounds of the Matrix.- Parameters:
row
- The element's row.col
- The element's column.- Returns:
- True if it is inside the matrices bound, false otherwise.
-
sum
public int sum()Returns the total number of elements which are true.- Returns:
- number of elements which are set to true
-
reshape
public void reshape(int numRows, int numCols) Description copied from interface:ReshapeMatrix
Equivalent to invoking reshape(numRows,numCols,false);- Specified by:
reshape
in interfaceReshapeMatrix
- Parameters:
numRows
- The new number of rows in the matrix.numCols
- The new number of columns in the matrix.
-
getNumRows
public int getNumRows()Description copied from interface:Matrix
Returns the number of rows in this matrix.- Specified by:
getNumRows
in interfaceMatrix
- Returns:
- Number of rows.
-
getNumCols
public int getNumCols()Description copied from interface:Matrix
Returns the number of columns in this matrix.- Specified by:
getNumCols
in interfaceMatrix
- Returns:
- Number of columns.
-
zero
public void zero()Description copied from interface:Matrix
Sets all values inside the matrix to zero -
copy
Description copied from interface:Matrix
Creates an exact copy of the matrix -
setTo
Description copied from interface:Matrix
Sets this matrix to be identical to the 'original' matrix passed in. -
print
public void print()Description copied from interface:Matrix
Prints the matrix to standard out using standard formatting. This is the same as calling print("%e") -
print
Description copied from interface:Matrix
Prints the matrix to standard out with the specified formatting. -
createLike
Description copied from interface:Matrix
Creates a new matrix with the same shape as this matrix- Specified by:
createLike
in interfaceMatrix
-
create
Description copied from interface:Matrix
Creates a new matrix of the same type with the specified shape -
getType
Description copied from interface:Matrix
Returns the type of matrix
-