@Override public ObjectMatrix<R, C, double[]> subset(int startRow, int startCol, int numRow, int numCol) { int endRow = startRow + numRow - 1; super.checkRowRange(startRow, endRow); int endCol = startCol + numCol - 1; super.checkColRange(startCol, endCol); ObjectMatrix<R, C, double[]> result = new CompressedBitMatrix<R, C>(numRow, numCol, this.totalBitsPerItem); int r = 0; for (int i = startRow; i < endRow; i++) { int c = 0; for (int j = startCol; j < endCol; j++) { result.set(r, c++, this.get(i, j)); } r++; } /* * FIXME set up the row/column names. */ return result; }
@Override public AbstractMatrix multiply(AbstractMatrix aMatrix) throws MatrixException { if (getColumns() != aMatrix.getRows()) { throw new MatrixException( "Could not multiply matrices [" + getRows() + "," + getColumns() + "] x [" + aMatrix.getRows() + "," + aMatrix.getColumns() + "]"); } Matrix2 theMatrix = new Matrix2(getRows(), aMatrix.getColumns()); double theValue = 0; for (int theMultiplyColumn = 0; theMultiplyColumn < aMatrix.getColumns(); theMultiplyColumn++) { for (int theMultiplyRow = 0; theMultiplyRow < getRows(); theMultiplyRow++) { theValue = 0; for (int thePosition = 0; thePosition < getColumns(); thePosition++) { theValue += getValueAt(theMultiplyRow, thePosition) * aMatrix.getValueAt(thePosition, theMultiplyColumn); } theMatrix.setValueAt(theMultiplyRow, theMultiplyColumn, theValue); } } return theMatrix; }
/** * Setter. * * @param animator The animator. */ public void setAnimator(final Animator animator) { super.setRefreshManager(animator); this.animator = animator; if (this.animator != null) { final AnimationList al = this.animator.getAnimationList(); for (final AnimatedDouble d : widths) { al.addAnimated(d); } for (final AnimatedDouble d : heights) { al.addAnimated(d); } } }