@Override public final void dotTimesEquals( final DenseMatrix other) { this.assertSameDimensions(other); for (int i = 0; i < diagonal.length; ++i) { diagonal[i] *= other.row(i).values[i]; } }
@Override public final void dotTimesEquals( final DenseMatrix other) { this.assertSameDimensions(other); for (int i = 0; i < diagonal.length; ++i) { diagonal[i] *= other.row(i).values[i]; } }
@Override public final void dotTimesEquals( final DenseMatrix other) { this.assertSameDimensions(other); for (int i = 0; i < diagonal.length; ++i) { diagonal[i] *= other.row(i).values[i]; } }
/** * {@inheritDoc} * @throws IllegalArgumentException if the input has any non-zero off-axis * elements as that would make this a non-diagonal matrix */ @Override public final void plusEquals( final DenseMatrix other) { this.assertSameDimensions(other); // I have to run through all values in the input to make sure all off- // diagonal are 0 (as well as summing along the diagonal) for (int i = 0; i < diagonal.length; ++i) { for (int j = 0; j < diagonal.length; ++j) { if (i == j) { diagonal[i] += other.row(i).values[i]; } else if (other.row(i).values[j] != 0) { throw new IllegalArgumentException("Unable to store the " + "sum of a non-diagonal dense matrix with a " + "diagonal matrix in the diagonal matrix."); } } } }
/** * {@inheritDoc} * @throws IllegalArgumentException if the input has any non-zero off-axis * elements as that would make this a non-diagonal matrix */ @Override public final void plusEquals( final DenseMatrix other) { this.assertSameDimensions(other); // I have to run through all values in the input to make sure all off- // diagonal are 0 (as well as summing along the diagonal) for (int i = 0; i < diagonal.length; ++i) { for (int j = 0; j < diagonal.length; ++j) { if (i == j) { diagonal[i] += other.row(i).values[i]; } else if (other.row(i).values[j] != 0) { throw new IllegalArgumentException("Unable to store the " + "sum of a non-diagonal dense matrix with a " + "diagonal matrix in the diagonal matrix."); } } } }
/** * {@inheritDoc} * @throws IllegalArgumentException if the input has any non-zero off-axis * elements as that would make this a non-diagonal matrix */ @Override public final void plusEquals( final DenseMatrix other) { this.assertSameDimensions(other); // I have to run through all values in the input to make sure all off- // diagonal are 0 (as well as summing along the diagonal) for (int i = 0; i < diagonal.length; ++i) { for (int j = 0; j < diagonal.length; ++j) { if (i == j) { diagonal[i] += other.row(i).values[i]; } else if (other.row(i).values[j] != 0) { throw new IllegalArgumentException("Unable to store the " + "sum of a non-diagonal dense matrix with a " + "diagonal matrix in the diagonal matrix."); } } } }
@Override public final Matrix times( final DenseMatrix other) { this.assertMultiplicationDimensions(other); final DenseVector[] rows = new DenseVector[diagonal.length]; for (int i = 0; i < diagonal.length; ++i) { DenseVector v = other.row(i); rows[i] = (DenseVector) v.scale(diagonal[i]); } return new DenseMatrix(rows); }
@Override public final Matrix times( final DenseMatrix other) { this.assertMultiplicationDimensions(other); final DenseVector[] rows = new DenseVector[diagonal.length]; for (int i = 0; i < diagonal.length; ++i) { DenseVector v = other.row(i); rows[i] = (DenseVector) v.scale(diagonal[i]); } return new DenseMatrix(rows); }
@Override public final Matrix times( final DenseMatrix other) { this.assertMultiplicationDimensions(other); final DenseVector[] rows = new DenseVector[diagonal.length]; for (int i = 0; i < diagonal.length; ++i) { DenseVector v = other.row(i); rows[i] = (DenseVector) v.scale(diagonal[i]); } return new DenseMatrix(rows); }
for (int j = 0; j < numCols; ++j) double val = d.row(i).values[j]; if (val != 0)
for (int j = 0; j < numCols; ++j) double val = d.row(i).values[j]; if (val != 0)