final double alpha = ((PlusMult) function).getMultiplicator();
if (alpha == 0) {
return this;
} // nothing to do
y.forEachNonZero(
new IntIntDoubleFunction() {
public double apply(int i, int j, double value) {
setQuick(i, j, getQuick(i, j) + alpha * value);
return value;
}
}
);
return this;
}
if (function == Functions.mult) { // x[i] = x[i] * y[i]
forEachNonZero(
new IntIntDoubleFunction() {
public double apply(int i, int j, double value) {
setQuick(i, j, getQuick(i, j) * y.getQuick(i, j));
return value;
}
}
);
return this;
}
if (function == Functions.div) { // x[i] = x[i] / y[i]
forEachNonZero(
new IntIntDoubleFunction() {
public double apply(int i, int j, double value) {
setQuick(i, j, getQuick(i, j) / y.getQuick(i, j));
return value;
}
}