/** * Internal function call that stores the result of a matrix multiply into the given * destinationMatrix. * * @param multiplicationMatrix matrix to postmultiply this by * @param destinationMatrix matrix to store the matrix multiplication result, must have rows == * this.getNumRows and columns == multiplicationMatrix.getNumColumns */ protected void timesInto( final AbstractMTJMatrix multiplicationMatrix, AbstractMTJMatrix destinationMatrix) { int M = this.getNumRows(); int N = multiplicationMatrix.getNumColumns(); if ((M != destinationMatrix.getNumRows()) || (N != destinationMatrix.getNumColumns())) { throw new DimensionalityMismatchException("Multiplication dimensions do not agree."); } this.internalMatrix.mult(multiplicationMatrix.internalMatrix, destinationMatrix.internalMatrix); }
/** * Internal routine for storing a submatrix into and AbstractMTJMatrix. Gets the embedded * submatrix inside of the Matrix, specified by the inclusive, zero-based indices such that the * result matrix will have size (maxRow-minRow+1) x (maxColum-minCcolumn+1) * * @param minRow Zero-based index into the rows of the Matrix, must be less than or equal to * maxRow * @param maxRow Zero-based index into the rows of the Matrix, must be greater than or equal to * minRow * @param minColumn Zero-based index into the rows of the Matrix, must be less than or equal to * maxColumn * @param maxColumn Zero-based index into the rows of the Matrix, must be greater than or equal to * minColumn * @param destinationMatrix the destination submatrix of dimension * (maxRow-minRow+1)x(maxColumn-minColumn+1) */ protected void getSubMatrixInto( int minRow, int maxRow, int minColumn, int maxColumn, AbstractMTJMatrix destinationMatrix) { if ((destinationMatrix.getNumRows() != (maxRow - minRow + 1)) || (destinationMatrix.getNumColumns() != (maxColumn - minColumn + 1))) { throw new DimensionalityMismatchException("Submatrix is incorrect size."); } for (int i = minRow; i <= maxRow; i++) { for (int j = minColumn; j <= maxColumn; j++) { destinationMatrix.setElement(i - minRow, j - minColumn, this.getElement(i, j)); } } }