Package org.ejml.data
Class BMatrixRMaj
- java.lang.Object
-
- org.ejml.data.BMatrixRMaj
-
- All Implemented Interfaces:
java.io.Serializable,Matrix,ReshapeMatrix
public class BMatrixRMaj extends java.lang.Object implements ReshapeMatrix
Dense matrix composed of boolean values- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BMatrixRMaj(int numRows, int numCols)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Matrix>
Tcopy()Creates an exact copy of the matrixBMatrixRMajcreate(int numRows, int numCols)Creates a new matrix of the same type with the specified shapeBMatrixRMajcreateLike()Creates 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)intgetNumCols()Returns the number of columns in this matrix.intgetNumElements()intgetNumRows()Returns the number of rows in this matrix.MatrixTypegetType()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.voidprint(java.lang.String format)Prints 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)voidset(Matrix original)Sets 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
-
-
-
Method Detail
-
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
public <T extends Matrix> T copy()
Description copied from interface:MatrixCreates an exact copy of the matrix
-
set
public void set(Matrix original)
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
public void print(java.lang.String format)
Description copied from interface:MatrixPrints the matrix to standard out with the specified formatting.
-
createLike
public BMatrixRMaj createLike()
Description copied from interface:MatrixCreates a new matrix with the same shape as this matrix- Specified by:
createLikein interfaceMatrix
-
create
public BMatrixRMaj create(int numRows, int numCols)
Description copied from interface:MatrixCreates a new matrix of the same type with the specified shape
-
getType
public MatrixType getType()
Description copied from interface:MatrixReturns the type of matrix
-
-