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
Fields -
Constructor Summary
Constructors -
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 matrixvoidfill(boolean value) Sets every element in the matrix to the specified valuebooleanget(int index) booleanget(int row, int col) intgetIndex(int row, int col) intReturns the number of columns in this matrix.intintReturns the number of rows in this matrix.getType()Returns the type of matrixbooleanisInBounds(int row, int col) Determines if the specified element is inside the bounds of the Matrix.voidprint()Prints the matrix to standard out using standard formatting.voidPrints the matrix to standard out with the specified formatting.voidreshape(int numRows, int numCols) Equivalent to invoking reshape(numRows,numCols,false);voidset(int row, int col, boolean value) voidSets this matrix to be identical to the 'original' matrix passed in.intsum()Returns the total number of elements which are true.booleanunsafe_get(int row, int col) voidunsafe_set(int row, int col, boolean value) voidzero()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:ReshapeMatrixEquivalent to invoking reshape(numRows,numCols,false);- Specified by:
reshapein 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:MatrixReturns the number of rows in this matrix.- Specified by:
getNumRowsin interfaceMatrix- Returns:
- Number of rows.
-
getNumCols
public int getNumCols()Description copied from interface:MatrixReturns the number of columns in this matrix.- Specified by:
getNumColsin interfaceMatrix- Returns:
- Number of columns.
-
zero
public void zero()Description copied from interface:MatrixSets all values inside the matrix to zero -
copy
Description copied from interface:MatrixCreates an exact copy of the matrix -
setTo
Description copied from interface:MatrixSets this matrix to be identical to the 'original' matrix passed in. -
print
public void print()Description copied from interface:MatrixPrints the matrix to standard out using standard formatting. This is the same as calling print("%e") -
print
Description copied from interface:MatrixPrints the matrix to standard out with the specified formatting. -
createLike
Description copied from interface:MatrixCreates a new matrix with the same shape as this matrix- Specified by:
createLikein interfaceMatrix
-
create
Description copied from interface:MatrixCreates a new matrix of the same type with the specified shape -
getType
Description copied from interface:MatrixReturns the type of matrix
-