/** * {@inheritDoc} * * NOTE: Upon completion this is in the compressed Yale format. */ @Override public final void dotTimesEquals( final DenseMatrix other) { this.assertSameDimensions(other); if (!isCompressed()) { compress(); } // The shortcut I'll take here is that few of the dense matrix's values // are zero where I'm not int rownum = 0; for (int i = 0; i < values.length; ++i) { while (i >= firstIndicesForRows[rownum + 1]) { ++rownum; } values[i] *= other.get(rownum, columnIndices[i]); } }
/** * {@inheritDoc} * * NOTE: Upon completion this is in the compressed Yale format. */ @Override public final void dotTimesEquals( final DenseMatrix other) { this.assertSameDimensions(other); if (!isCompressed()) { compress(); } // The shortcut I'll take here is that few of the dense matrix's values // are zero where I'm not int rownum = 0; for (int i = 0; i < values.length; ++i) { while (i >= firstIndicesForRows[rownum + 1]) { ++rownum; } values[i] *= other.get(rownum, columnIndices[i]); } }
/** * {@inheritDoc} * * NOTE: Upon completion this is in the compressed Yale format. */ @Override public final void dotTimesEquals( final DenseMatrix other) { this.assertSameDimensions(other); if (!isCompressed()) { compress(); } // The shortcut I'll take here is that few of the dense matrix's values // are zero where I'm not int rownum = 0; for (int i = 0; i < values.length; ++i) { while (i >= firstIndicesForRows[rownum + 1]) { ++rownum; } values[i] *= other.get(rownum, columnIndices[i]); } }
final SparseMatrix other) this.assertSameDimensions(other); if (!isCompressed())
final SparseMatrix other) this.assertSameDimensions(other); if (!isCompressed())
final SparseMatrix other) this.assertSameDimensions(other); if (!isCompressed())
final SparseMatrix other) this.assertSameDimensions(other); if (!isCompressed())
final double scaleFactor) this.assertSameDimensions(other); if (!isCompressed())
final SparseMatrix other) this.assertSameDimensions(other); if (!isCompressed())
final SparseMatrix other) this.assertSameDimensions(other); if (!isCompressed())
final double scaleFactor) this.assertSameDimensions(other); if (!isCompressed())
/** * {@inheritDoc} * * NOTE: Upon completion this is in the compressed Yale format. */ @Override public final void plusEquals( final DiagonalMatrix other) { this.assertSameDimensions(other); if (!isCompressed()) { compress(); } // Count the number of new values to add. int nnz = getNumNonZeroWhenCombinedWith(getZeroToNMinusOneArray( other.getNumRows()), getZeroToNMinusOneArray(other.getNumRows() + 1), Combiner.OR); // Now start up the values for the sum matrix double[] newVals = new double[nnz]; int[] newFirstIdxsForRows = new int[firstIndicesForRows.length]; int[] newColIdxs = new int[nnz]; // Now do the logic for adding plusEqualsScaled(newColIdxs, newFirstIdxsForRows, newVals, other, 1); // Now store the new values in me values = newVals; columnIndices = newColIdxs; firstIndicesForRows = newFirstIdxsForRows; }
/** * {@inheritDoc} * * NOTE: Upon completion this is in the compressed Yale format. */ @Override public final void minusEquals( final DiagonalMatrix other) { this.assertSameDimensions(other); if (!isCompressed()) { compress(); } // Count the number of new values to add. int nnz = getNumNonZeroWhenCombinedWith(getZeroToNMinusOneArray( other.getNumRows()), getZeroToNMinusOneArray(other.getNumRows() + 1), Combiner.OR); // Initialize the new matrix storage double[] newVals = new double[nnz]; int[] newFirstIdxsForRows = new int[firstIndicesForRows.length]; int[] newColIdxs = new int[nnz]; // Actually do the computation plusEqualsScaled(newColIdxs, newFirstIdxsForRows, newVals, other, -1); // Store the results values = newVals; columnIndices = newColIdxs; firstIndicesForRows = newFirstIdxsForRows; }
/** * {@inheritDoc} * * NOTE: Upon completion this is in the compressed Yale format. */ @Override public final void minusEquals( final DiagonalMatrix other) { this.assertSameDimensions(other); if (!isCompressed()) { compress(); } // Count the number of new values to add. int nnz = getNumNonZeroWhenCombinedWith(getZeroToNMinusOneArray( other.getNumRows()), getZeroToNMinusOneArray(other.getNumRows() + 1), Combiner.OR); // Initialize the new matrix storage double[] newVals = new double[nnz]; int[] newFirstIdxsForRows = new int[firstIndicesForRows.length]; int[] newColIdxs = new int[nnz]; // Actually do the computation plusEqualsScaled(newColIdxs, newFirstIdxsForRows, newVals, other, -1); // Store the results values = newVals; columnIndices = newColIdxs; firstIndicesForRows = newFirstIdxsForRows; }
/** * {@inheritDoc} * * NOTE: Upon completion this is in the compressed Yale format. */ @Override public void scaledPlusEquals( final DiagonalMatrix other, final double scaleFactor) { this.assertSameDimensions(other); if (!isCompressed()) { compress(); } // Count the number of new values to add. int nnz = getNumNonZeroWhenCombinedWith(getZeroToNMinusOneArray( other.getNumRows()), getZeroToNMinusOneArray(other.getNumRows() + 1), Combiner.OR); // Now start up the values for the sum matrix double[] newVals = new double[nnz]; int[] newFirstIdxsForRows = new int[firstIndicesForRows.length]; int[] newColIdxs = new int[nnz]; // Now do the logic for adding plusEqualsScaled(newColIdxs, newFirstIdxsForRows, newVals, other, 1); // Now store the new values in me values = newVals; columnIndices = newColIdxs; firstIndicesForRows = newFirstIdxsForRows; }
/** * {@inheritDoc} * * NOTE: Upon completion this is in the compressed Yale format. */ @Override public void scaledPlusEquals( final DiagonalMatrix other, final double scaleFactor) { this.assertSameDimensions(other); if (!isCompressed()) { compress(); } // Count the number of new values to add. int nnz = getNumNonZeroWhenCombinedWith(getZeroToNMinusOneArray( other.getNumRows()), getZeroToNMinusOneArray(other.getNumRows() + 1), Combiner.OR); // Now start up the values for the sum matrix double[] newVals = new double[nnz]; int[] newFirstIdxsForRows = new int[firstIndicesForRows.length]; int[] newColIdxs = new int[nnz]; // Now do the logic for adding plusEqualsScaled(newColIdxs, newFirstIdxsForRows, newVals, other, 1); // Now store the new values in me values = newVals; columnIndices = newColIdxs; firstIndicesForRows = newFirstIdxsForRows; }
/** * {@inheritDoc} * * NOTE: Upon completion this is in the compressed Yale format. */ @Override public final void plusEquals( final DiagonalMatrix other) { this.assertSameDimensions(other); if (!isCompressed()) { compress(); } // Count the number of new values to add. int nnz = getNumNonZeroWhenCombinedWith(getZeroToNMinusOneArray( other.getNumRows()), getZeroToNMinusOneArray(other.getNumRows() + 1), Combiner.OR); // Now start up the values for the sum matrix double[] newVals = new double[nnz]; int[] newFirstIdxsForRows = new int[firstIndicesForRows.length]; int[] newColIdxs = new int[nnz]; // Now do the logic for adding plusEqualsScaled(newColIdxs, newFirstIdxsForRows, newVals, other, 1); // Now store the new values in me values = newVals; columnIndices = newColIdxs; firstIndicesForRows = newFirstIdxsForRows; }
/** * {@inheritDoc} * * NOTE: Upon completion this is in the compressed Yale format. */ @Override public final void minusEquals( final DiagonalMatrix other) { this.assertSameDimensions(other); if (!isCompressed()) { compress(); } // Count the number of new values to add. int nnz = getNumNonZeroWhenCombinedWith(getZeroToNMinusOneArray( other.getNumRows()), getZeroToNMinusOneArray(other.getNumRows() + 1), Combiner.OR); // Initialize the new matrix storage double[] newVals = new double[nnz]; int[] newFirstIdxsForRows = new int[firstIndicesForRows.length]; int[] newColIdxs = new int[nnz]; // Actually do the computation plusEqualsScaled(newColIdxs, newFirstIdxsForRows, newVals, other, -1); // Store the results values = newVals; columnIndices = newColIdxs; firstIndicesForRows = newFirstIdxsForRows; }
/** * {@inheritDoc} * * NOTE: Upon completion this is in the compressed Yale format. */ @Override public final void plusEquals( final DiagonalMatrix other) { this.assertSameDimensions(other); if (!isCompressed()) { compress(); } // Count the number of new values to add. int nnz = getNumNonZeroWhenCombinedWith(getZeroToNMinusOneArray( other.getNumRows()), getZeroToNMinusOneArray(other.getNumRows() + 1), Combiner.OR); // Now start up the values for the sum matrix double[] newVals = new double[nnz]; int[] newFirstIdxsForRows = new int[firstIndicesForRows.length]; int[] newColIdxs = new int[nnz]; // Now do the logic for adding plusEqualsScaled(newColIdxs, newFirstIdxsForRows, newVals, other, 1); // Now store the new values in me values = newVals; columnIndices = newColIdxs; firstIndicesForRows = newFirstIdxsForRows; }
/** * {@inheritDoc} * * NOTE: Upon completion this is in the compressed Yale format. */ @Override public void scaledPlusEquals( final DiagonalMatrix other, final double scaleFactor) { this.assertSameDimensions(other); if (!isCompressed()) { compress(); } // Count the number of new values to add. int nnz = getNumNonZeroWhenCombinedWith(getZeroToNMinusOneArray( other.getNumRows()), getZeroToNMinusOneArray(other.getNumRows() + 1), Combiner.OR); // Now start up the values for the sum matrix double[] newVals = new double[nnz]; int[] newFirstIdxsForRows = new int[firstIndicesForRows.length]; int[] newColIdxs = new int[nnz]; // Now do the logic for adding plusEqualsScaled(newColIdxs, newFirstIdxsForRows, newVals, other, 1); // Now store the new values in me values = newVals; columnIndices = newColIdxs; firstIndicesForRows = newFirstIdxsForRows; }