Package jline.util.matrix
Class DenseMatrix
java.lang.Object
jline.util.matrix.BaseMatrix
jline.util.matrix.DenseMatrix
- All Implemented Interfaces:
Serializable
Base class for dense matrix implementations, containing the core data structure
and methods that directly manipulate the underlying dense matrix representation.
This class encapsulates all interactions with EJML's DMatrixRMaj and
CommonOps_DDRM classes, providing a clean abstraction layer for dense matrix
operations. It serves as the foundation for concrete dense matrix implementations.
The class provides:
- Basic matrix operations (get, set, dimensions)
- Encapsulated CommonOps_DDRM method calls
- Memory management for dense matrix data structures
- Utility methods for matrix manipulation
Dense matrices store all elements (including zeros) explicitly, making them suitable for matrices with a high percentage of non-zero elements or when dense linear algebra operations are required.
- Since:
- 1.0
- Author:
- QORE Lab, Imperial College London
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedProtected constructor for delayed initialization.DenseMatrix(int numRows, int numCols) Constructs a dense matrix with specified dimensions.protectedDenseMatrix(DenseMatrix matrix) Copy constructor for creating a new dense matrix from an existing one.DenseMatrix(org.ejml.data.DMatrix matrix) Constructs a dense matrix by copying an existing DMatrix.DenseMatrix(org.ejml.data.DMatrixRMaj matrix) Constructs a dense matrix by copying an existing EJML dense matrix. -
Method Summary
Modifier and TypeMethodDescriptionvoidabsEq()Replaces each value in the matrix with its absolute value, in-place.protected voidadd(double alpha, org.ejml.data.DMatrix A, double beta, org.ejml.data.DMatrix B, org.ejml.data.DMatrix output) Performs the operation: output = alpha*A + beta*B.protected org.ejml.data.DMatrixaddMatrices(double alpha, org.ejml.data.DMatrix A, double beta, org.ejml.data.DMatrix B, org.ejml.data.DMatrix output) Performs the operation: output = alpha*A + beta*B.protected voidaddMatricesInPlace(double alpha, org.ejml.data.DMatrix A, double beta, org.ejml.data.DMatrix B, org.ejml.data.DMatrix output) protected static voidaddMatricesInPlaceStatic(double alpha, org.ejml.data.DMatrix A, double beta, org.ejml.data.DMatrix B, org.ejml.data.DMatrix output) protected static org.ejml.data.DMatrixRMajaddMatricesStatic(double alpha, org.ejml.data.DMatrix A, double beta, org.ejml.data.DMatrix B, org.ejml.data.DMatrix output) protected static org.ejml.data.DMatrixRMajaddStatic(org.ejml.data.DMatrixRMaj A, org.ejml.data.DMatrixRMaj B, org.ejml.data.DMatrixRMaj output) Performs element-wise addition of two dense matrices: output = A + B.booleanany()Checks if the current matrix contains any non-zero elements.protected voidapplyConditionalTransform(double source, double target, double tol, String operation) Applies a transformation to matrix elements based on conditions.protected voidprotected static voidchangeSignStatic(org.ejml.data.DMatrix input, org.ejml.data.DMatrix output) voidcolIncrease(int col, double a) Adds a scalar value to each element in the specified column.protected voidconcatColumnsInPlace(org.ejml.data.DMatrix left, org.ejml.data.DMatrix right, org.ejml.data.DMatrix output) Concatenates matrices column-wise.protected voidconcatRowsInPlace(org.ejml.data.DMatrix top, org.ejml.data.DMatrix bottom, org.ejml.data.DMatrix output) Concatenates matrices row-wise.abstract BaseMatrixcopy()Creates and returns a deep copy of this dense matrix.countEachRow(double val) Counts occurrences of each unique value in each row.protected abstract BaseMatrixcreateNewInstance(int rows, int cols, int nzLength) Creates a new instance of the concrete dense matrix implementation.protected doubleprotected static doubledeterminantStatic(org.ejml.data.DMatrix matrix) protected voiddivideInPlace(double scalar) protected voiddivideMatrix(double scalar, org.ejml.data.DMatrix output) protected voiddivideRowsByArray(double[] diag, int offset) protected voiddivideScalarByMatrix(double scalar, org.ejml.data.DMatrix output) protected doubleprotected doubleprotected doubleprotected org.ejml.data.DMatrixelementMult(org.ejml.data.DMatrix A, org.ejml.data.DMatrix B, org.ejml.data.DMatrix output) protected static org.ejml.data.DMatrixRMajelementMultStatic(org.ejml.data.DMatrix A, org.ejml.data.DMatrix B, org.ejml.data.DMatrix output) protected doubleabstract booleanIndicates whether some other object is "equal to" this dense matrix.protected voidextractMatrix(org.ejml.data.DMatrix src, int srcX0, int srcX1, int srcY0, int srcY1, org.ejml.data.DMatrix dst, int dstY0, int dstX0) protected static voidextractMatrixStatic(org.ejml.data.DMatrix src, int srcX0, int srcX1, int srcY0, int srcY1, org.ejml.data.DMatrix dst, int dstY0, int dstX0) protected voidfillMatrix(double value) Fills the matrix with the specified value.protected static voidfillMatrixStatic(org.ejml.data.DMatrix matrix, double value) Returns a matrix containing indices of all non-negative elements.doubleget(int row, int col) Returns the value at the specified matrix position.protected intgetColumnIndex(int col) protected int[]protected org.ejml.data.DMatrixRMajgetData()Returns the underlying EJML dense matrix data structure.intReturns the number of stored non-zero elements.protected intgetNonZeroRow(int index) int[]Returns array of row indices of non-zero entries.intReturns the number of non-zero elements in the matrix.protected doublegetNonZeroValue(int index) double[]Returns array of non-zero values.intReturns the number of columns in the matrix.intReturns the number of rows in the matrix.booleanChecks if the matrix contains duplicate values.booleanChecks if the matrix contains any finite (non-infinite, non-NaN) values.booleanChecks if the matrix contains any infinite values.booleanChecks if more than one finite value exists.booleanhasNaN()Checks if the matrix contains any NaN values.protected static org.ejml.data.DMatrixRMajidentityStatic(int size) Creates an identity matrix of the specified size.protected static voidinvertStatic(org.ejml.data.DMatrix input, org.ejml.data.DMatrix output) protected static org.ejml.data.DMatrixRMajkronStatic(org.ejml.data.DMatrixRMaj A, org.ejml.data.DMatrixRMaj B, org.ejml.data.DMatrixRMaj output) Computes the Kronecker product of two dense matrices: A \otimes B.protected voidmult(org.ejml.data.DMatrix A, org.ejml.data.DMatrix B, org.ejml.data.DMatrix output) Performs matrix multiplication: output = A * B.protected org.ejml.data.DMatrixmultMatrix(org.ejml.data.DMatrix B, org.ejml.data.DMatrix output) Performs matrix multiplication with sparse matrices.protected static org.ejml.data.DMatrixRMajmultMatrixStatic(org.ejml.data.DMatrix A, org.ejml.data.DMatrix B, org.ejml.data.DMatrix output) protected voidRemoves zero-valued elements from the matrix with default tolerance.protected voidremoveZerosWithTol(double tolerance) Removes zero-valued elements from the matrix with specified tolerance.voidreshape(int numRows, int numCols) Reshapes the matrix to the specified dimensions.protected voidscaleInPlace(double alpha) Scales the matrix in-place by the specified factor.protected voidscaleMatrix(double scalar, org.ejml.data.DMatrix output) protected static voidscaleMatrixStatic(double scalar, org.ejml.data.DMatrix input, org.ejml.data.DMatrix output) voidset(int row, int col, double value) Sets the value at the specified matrix position.protected voidsetColumnIndex(int col, int value) protected voidSets the underlying data structure.voidsetData(org.ejml.data.DMatrix newData) Sets the underlying EJML dense matrix data structure.protected voidsetData(org.ejml.data.DMatrixRMaj newData) Sets the underlying EJML dense matrix data structure.protected voidsetNonZeroLength(int length) protected voidsetNonZeroRow(int index, int row) protected voidsetNonZeroValue(int index, double value) voidshrinkNumCols(int newmax) Reduce the maximum number of columns by setting the internal column count.voidshrinkNumRows(int newmax) Reduce the maximum number of rows by setting the internal row count.protected org.ejml.data.DMatrixprotected org.ejml.data.DMatrixtoString()Returns a string representation of the matrix.protected voidtranspose(org.ejml.data.DMatrix input, org.ejml.data.DMatrix output) Computes the transpose of the input matrix.protected voidtransposeMatrix(org.ejml.data.DMatrix output) Computes the transpose of this matrix.protected static voidtransposeMatrixStatic(org.ejml.data.DMatrix input, org.ejml.data.DMatrix output) voidzero()Sets all elements in the matrix to zero.Methods inherited from class jline.util.matrix.BaseMatrix
getNumNonZeros
-
Constructor Details
-
DenseMatrix
public DenseMatrix(int numRows, int numCols) Constructs a dense matrix with specified dimensions. All elements are initialized to zero.- Parameters:
numRows- the number of rows in the matrixnumCols- the number of columns in the matrix
-
DenseMatrix
public DenseMatrix(org.ejml.data.DMatrixRMaj matrix) Constructs a dense matrix by copying an existing EJML dense matrix.- Parameters:
matrix- the EJML dense matrix to copy
-
DenseMatrix
public DenseMatrix(org.ejml.data.DMatrix matrix) Constructs a dense matrix by copying an existing DMatrix.- Parameters:
matrix- the DMatrix to copy
-
DenseMatrix
Copy constructor for creating a new dense matrix from an existing one.- Parameters:
matrix- the dense matrix to copy
-
DenseMatrix
protected DenseMatrix()Protected constructor for delayed initialization. Subclasses must ensure that data is properly initialized.
-
-
Method Details
-
addMatricesInPlaceStatic
protected static void addMatricesInPlaceStatic(double alpha, org.ejml.data.DMatrix A, double beta, org.ejml.data.DMatrix B, org.ejml.data.DMatrix output) -
addMatricesStatic
protected static org.ejml.data.DMatrixRMaj addMatricesStatic(double alpha, org.ejml.data.DMatrix A, double beta, org.ejml.data.DMatrix B, org.ejml.data.DMatrix output) -
addStatic
protected static org.ejml.data.DMatrixRMaj addStatic(org.ejml.data.DMatrixRMaj A, org.ejml.data.DMatrixRMaj B, org.ejml.data.DMatrixRMaj output) Performs element-wise addition of two dense matrices: output = A + B.- Parameters:
A- the first matrixB- the second matrixoutput- the result matrix (can be null to create a new matrix)- Returns:
- the sum matrix
-
changeSignStatic
protected static void changeSignStatic(org.ejml.data.DMatrix input, org.ejml.data.DMatrix output) -
determinantStatic
protected static double determinantStatic(org.ejml.data.DMatrix matrix) -
elementMultStatic
protected static org.ejml.data.DMatrixRMaj elementMultStatic(org.ejml.data.DMatrix A, org.ejml.data.DMatrix B, org.ejml.data.DMatrix output) -
extractMatrixStatic
protected static void extractMatrixStatic(org.ejml.data.DMatrix src, int srcX0, int srcX1, int srcY0, int srcY1, org.ejml.data.DMatrix dst, int dstY0, int dstX0) -
fillMatrixStatic
protected static void fillMatrixStatic(org.ejml.data.DMatrix matrix, double value) -
identityStatic
protected static org.ejml.data.DMatrixRMaj identityStatic(int size) Creates an identity matrix of the specified size. An identity matrix has ones on the main diagonal and zeros elsewhere.- Parameters:
size- the number of rows and columns in the identity matrix- Returns:
- a new identity matrix
-
invertStatic
protected static void invertStatic(org.ejml.data.DMatrix input, org.ejml.data.DMatrix output) -
kronStatic
protected static org.ejml.data.DMatrixRMaj kronStatic(org.ejml.data.DMatrixRMaj A, org.ejml.data.DMatrixRMaj B, org.ejml.data.DMatrixRMaj output) Computes the Kronecker product of two dense matrices: A \otimes B. The Kronecker product creates a larger matrix where each element of A is multiplied by the entire matrix B.- Parameters:
A- the left matrixB- the right matrixoutput- the result matrix (can be null to create a new matrix)- Returns:
- the Kronecker product matrix
-
multMatrixStatic
protected static org.ejml.data.DMatrixRMaj multMatrixStatic(org.ejml.data.DMatrix A, org.ejml.data.DMatrix B, org.ejml.data.DMatrix output) -
scaleMatrixStatic
protected static void scaleMatrixStatic(double scalar, org.ejml.data.DMatrix input, org.ejml.data.DMatrix output) -
transposeMatrixStatic
protected static void transposeMatrixStatic(org.ejml.data.DMatrix input, org.ejml.data.DMatrix output) -
absEq
public void absEq()Description copied from class:BaseMatrixReplaces each value in the matrix with its absolute value, in-place.- Specified by:
absEqin classBaseMatrix
-
add
protected void add(double alpha, org.ejml.data.DMatrix A, double beta, org.ejml.data.DMatrix B, org.ejml.data.DMatrix output) Performs the operation: output = alpha*A + beta*B.- Parameters:
alpha- scalar coefficient for matrix AA- first input matrixbeta- scalar coefficient for matrix BB- second input matrixoutput- the result matrix
-
addMatrices
protected org.ejml.data.DMatrix addMatrices(double alpha, org.ejml.data.DMatrix A, double beta, org.ejml.data.DMatrix B, org.ejml.data.DMatrix output) Description copied from class:BaseMatrixPerforms the operation: output = alpha*A + beta*B.- Specified by:
addMatricesin classBaseMatrix- Parameters:
alpha- scalar coefficient for matrix AA- first input matrixbeta- scalar coefficient for matrix BB- second input matrixoutput- the result matrix
-
addMatricesInPlace
protected void addMatricesInPlace(double alpha, org.ejml.data.DMatrix A, double beta, org.ejml.data.DMatrix B, org.ejml.data.DMatrix output) -
any
public boolean any()Description copied from class:BaseMatrixChecks if the current matrix contains any non-zero elements.- Specified by:
anyin classBaseMatrix- Returns:
trueif at least one non-zero element exists;falseotherwise.
-
applyConditionalTransform
protected void applyConditionalTransform(double source, double target, double tol, String operation) Description copied from class:BaseMatrixApplies a transformation to matrix elements based on conditions. Replaces elements matching the condition with the target value.- Specified by:
applyConditionalTransformin classBaseMatrix
-
changeSign
protected void changeSign()- Specified by:
changeSignin classBaseMatrix
-
copy
Creates and returns a deep copy of this dense matrix.- Specified by:
copyin classBaseMatrix- Returns:
- a new dense matrix that is a copy of this instance
-
colIncrease
public void colIncrease(int col, double a) Description copied from class:BaseMatrixAdds a scalar value to each element in the specified column.- Specified by:
colIncreasein classBaseMatrix- Parameters:
col- Column index to update.a- Scalar value to add to each element in the column.
-
concatColumnsInPlace
protected void concatColumnsInPlace(org.ejml.data.DMatrix left, org.ejml.data.DMatrix right, org.ejml.data.DMatrix output) Description copied from class:BaseMatrixConcatenates matrices column-wise.- Specified by:
concatColumnsInPlacein classBaseMatrix- Parameters:
left- the left matrixright- the right matrixoutput- the result matrix
-
concatRowsInPlace
protected void concatRowsInPlace(org.ejml.data.DMatrix top, org.ejml.data.DMatrix bottom, org.ejml.data.DMatrix output) Description copied from class:BaseMatrixConcatenates matrices row-wise.- Specified by:
concatRowsInPlacein classBaseMatrix- Parameters:
top- the top matrixbottom- the bottom matrixoutput- the result matrix
-
countEachRow
Description copied from class:BaseMatrixCounts occurrences of each unique value in each row.- Specified by:
countEachRowin classBaseMatrix
-
createNewInstance
Creates a new instance of the concrete dense matrix implementation. This factory method allows the base class to create instances of the correct subtype.- Specified by:
createNewInstancein classBaseMatrix- Parameters:
rows- the number of rows for the new matrixcols- the number of columns for the new matrixnzLength- the initial capacity for non-zero elements (may be ignored by dense matrices)- Returns:
- a new instance of the concrete dense matrix type
-
determinant
protected double determinant()- Specified by:
determinantin classBaseMatrix
-
divideInPlace
protected void divideInPlace(double scalar) - Specified by:
divideInPlacein classBaseMatrix
-
divideMatrix
protected void divideMatrix(double scalar, org.ejml.data.DMatrix output) - Specified by:
divideMatrixin classBaseMatrix
-
divideRowsByArray
protected void divideRowsByArray(double[] diag, int offset) - Specified by:
divideRowsByArrayin classBaseMatrix
-
divideScalarByMatrix
protected void divideScalarByMatrix(double scalar, org.ejml.data.DMatrix output) - Specified by:
divideScalarByMatrixin classBaseMatrix
-
elementMax
protected double elementMax()- Specified by:
elementMaxin classBaseMatrix
-
elementMaxAbs
protected double elementMaxAbs()- Specified by:
elementMaxAbsin classBaseMatrix
-
elementMin
protected double elementMin()- Specified by:
elementMinin classBaseMatrix
-
elementMult
protected org.ejml.data.DMatrix elementMult(org.ejml.data.DMatrix A, org.ejml.data.DMatrix B, org.ejml.data.DMatrix output) - Specified by:
elementMultin classBaseMatrix
-
elementSum
protected double elementSum()- Specified by:
elementSumin classBaseMatrix
-
equals
Indicates whether some other object is "equal to" this dense matrix.- Specified by:
equalsin classBaseMatrix- Parameters:
obj- the reference object with which to compare- Returns:
trueif this object is the same as the obj argument;falseotherwise
-
extractMatrix
protected void extractMatrix(org.ejml.data.DMatrix src, int srcX0, int srcX1, int srcY0, int srcY1, org.ejml.data.DMatrix dst, int dstY0, int dstX0) - Specified by:
extractMatrixin classBaseMatrix
-
fillMatrix
protected void fillMatrix(double value) Description copied from class:BaseMatrixFills the matrix with the specified value.- Specified by:
fillMatrixin classBaseMatrix- Parameters:
value- the value to fill the matrix with
-
findNonNegative
Description copied from class:BaseMatrixReturns a matrix containing indices of all non-negative elements.- Specified by:
findNonNegativein classBaseMatrix
-
get
public double get(int row, int col) Returns the value at the specified matrix position.- Specified by:
getin classBaseMatrix- Parameters:
row- the row indexcol- the column index- Returns:
- the value at position (row, col)
-
getColumnIndex
protected int getColumnIndex(int col) - Specified by:
getColumnIndexin classBaseMatrix
-
getColumnIndicesArray
protected int[] getColumnIndicesArray()- Specified by:
getColumnIndicesArrayin classBaseMatrix
-
getData
protected org.ejml.data.DMatrixRMaj getData()Returns the underlying EJML dense matrix data structure. This method provides direct access to the internal data for subclasses.- Specified by:
getDatain classBaseMatrix- Returns:
- the underlying
DMatrixRMajinstance
-
setData
protected void setData(org.ejml.data.DMatrixRMaj newData) Sets the underlying EJML dense matrix data structure. This method allows subclasses to replace the internal data.- Parameters:
newData- the newDMatrixRMajinstance to use
-
setData
public void setData(org.ejml.data.DMatrix newData) Sets the underlying EJML dense matrix data structure. This method allows subclasses to replace the internal data.- Parameters:
newData- the new DMatrix instance to use
-
setData
Description copied from class:BaseMatrixSets the underlying data structure. Implementation depends on the concrete matrix type.- Specified by:
setDatain classBaseMatrix- Parameters:
newData- the new data structure
-
getNonZeroLength
public int getNonZeroLength()Description copied from class:BaseMatrixReturns the number of stored non-zero elements. This may be different from actual non-zero count for dense matrices.- Specified by:
getNonZeroLengthin classBaseMatrix- Returns:
- number of stored non-zero elements
-
setNonZeroLength
protected void setNonZeroLength(int length) - Specified by:
setNonZeroLengthin classBaseMatrix
-
getNonZeroRow
protected int getNonZeroRow(int index) - Specified by:
getNonZeroRowin classBaseMatrix
-
getNonZeroRows
public int[] getNonZeroRows()Description copied from class:BaseMatrixReturns array of row indices of non-zero entries. For dense matrices, this may compute row indices dynamically. For sparse matrices, this returns the compressed row index array.- Specified by:
getNonZeroRowsin classBaseMatrix- Returns:
- array of row indices
-
getNonZeroValue
protected double getNonZeroValue(int index) - Specified by:
getNonZeroValuein classBaseMatrix
-
getNonZeroValues
public double[] getNonZeroValues()Description copied from class:BaseMatrixReturns array of non-zero values. For dense matrices, this may return all values or only actual non-zeros. For sparse matrices, this returns the compressed storage array.- Specified by:
getNonZeroValuesin classBaseMatrix- Returns:
- array of non-zero values
-
getNonZeros
public int getNonZeros()Description copied from class:BaseMatrixReturns the number of non-zero elements in the matrix. For dense matrices, this counts actual non-zero values. For sparse matrices, this returns the stored non-zero count.- Specified by:
getNonZerosin classBaseMatrix- Returns:
- the number of non-zero elements
-
getNumCols
public int getNumCols()Returns the number of columns in the matrix.- Specified by:
getNumColsin classBaseMatrix- Returns:
- the number of columns
-
getNumRows
public int getNumRows()Returns the number of rows in the matrix.- Specified by:
getNumRowsin classBaseMatrix- Returns:
- the number of rows
-
hasDuplicates
public boolean hasDuplicates()Description copied from class:BaseMatrixChecks if the matrix contains duplicate values.- Specified by:
hasDuplicatesin classBaseMatrix- Returns:
- true if duplicates exist
-
hasFinite
public boolean hasFinite()Description copied from class:BaseMatrixChecks if the matrix contains any finite (non-infinite, non-NaN) values.- Specified by:
hasFinitein classBaseMatrix- Returns:
- true if at least one finite value exists
-
hasInfinite
public boolean hasInfinite()Description copied from class:BaseMatrixChecks if the matrix contains any infinite values.- Specified by:
hasInfinitein classBaseMatrix- Returns:
- true if at least one infinite value exists
-
hasMultipleFinite
public boolean hasMultipleFinite()Description copied from class:BaseMatrixChecks if more than one finite value exists.- Specified by:
hasMultipleFinitein classBaseMatrix- Returns:
- true if more than one finite value exists
-
hasNaN
public boolean hasNaN()Description copied from class:BaseMatrixChecks if the matrix contains any NaN values.- Specified by:
hasNaNin classBaseMatrix- Returns:
- true if at least one NaN exists
-
mult
protected void mult(org.ejml.data.DMatrix A, org.ejml.data.DMatrix B, org.ejml.data.DMatrix output) Performs matrix multiplication: output = A * B.- Parameters:
A- the left matrixB- the right matrixoutput- the result matrix
-
multMatrix
protected org.ejml.data.DMatrix multMatrix(org.ejml.data.DMatrix B, org.ejml.data.DMatrix output) Description copied from class:BaseMatrixPerforms matrix multiplication with sparse matrices.- Specified by:
multMatrixin classBaseMatrix- Parameters:
B- the right matrixoutput- the result matrix
-
removeZeros
protected void removeZeros()Description copied from class:BaseMatrixRemoves zero-valued elements from the matrix with default tolerance. For dense matrices, this may be a no-op or convert to sparse representation.- Specified by:
removeZerosin classBaseMatrix
-
removeZerosWithTol
protected void removeZerosWithTol(double tolerance) Description copied from class:BaseMatrixRemoves zero-valued elements from the matrix with specified tolerance.- Specified by:
removeZerosWithTolin classBaseMatrix- Parameters:
tolerance- the tolerance for considering values as zero
-
reshape
public void reshape(int numRows, int numCols) Reshapes the matrix to the specified dimensions.- Specified by:
reshapein classBaseMatrix- Parameters:
numRows- the new number of rowsnumCols- the new number of columns
-
scaleInPlace
protected void scaleInPlace(double alpha) Description copied from class:BaseMatrixScales the matrix in-place by the specified factor.- Specified by:
scaleInPlacein classBaseMatrix- Parameters:
alpha- the scaling factor
-
scaleMatrix
protected void scaleMatrix(double scalar, org.ejml.data.DMatrix output) - Specified by:
scaleMatrixin classBaseMatrix
-
set
public void set(int row, int col, double value) Sets the value at the specified matrix position.- Specified by:
setin classBaseMatrix- Parameters:
row- the row indexcol- the column indexvalue- the value to set
-
setColumnIndex
protected void setColumnIndex(int col, int value) - Specified by:
setColumnIndexin classBaseMatrix
-
setNonZeroRow
protected void setNonZeroRow(int index, int row) - Specified by:
setNonZeroRowin classBaseMatrix
-
setNonZeroValue
protected void setNonZeroValue(int index, double value) - Specified by:
setNonZeroValuein classBaseMatrix
-
shrinkNumCols
public void shrinkNumCols(int newmax) Description copied from class:BaseMatrixReduce the maximum number of columns by setting the internal column count.- Specified by:
shrinkNumColsin classBaseMatrix- Parameters:
newmax- the new maximum number of columns
-
shrinkNumRows
public void shrinkNumRows(int newmax) Description copied from class:BaseMatrixReduce the maximum number of rows by setting the internal row count.- Specified by:
shrinkNumRowsin classBaseMatrix- Parameters:
newmax- the new maximum number of rows
-
sumColsRaw
protected org.ejml.data.DMatrix sumColsRaw()- Specified by:
sumColsRawin classBaseMatrix
-
sumRowsRaw
protected org.ejml.data.DMatrix sumRowsRaw()- Specified by:
sumRowsRawin classBaseMatrix
-
toString
Returns a string representation of the matrix. Elements are formatted to 4 decimal places in a grid layout.- Overrides:
toStringin classBaseMatrix- Returns:
- a formatted string representation of the matrix
-
transpose
protected void transpose(org.ejml.data.DMatrix input, org.ejml.data.DMatrix output) Computes the transpose of the input matrix.- Parameters:
input- the matrix to transposeoutput- the transposed matrix
-
transposeMatrix
protected void transposeMatrix(org.ejml.data.DMatrix output) Description copied from class:BaseMatrixComputes the transpose of this matrix.- Specified by:
transposeMatrixin classBaseMatrix- Parameters:
output- the transposed matrix
-
zero
public void zero()Sets all elements in the matrix to zero.- Specified by:
zeroin classBaseMatrix
-