residual method Null safety
Computes this = this - a dot b. r, a and b must already be properly dimensioned.
Implementation
void residual(AMatrix a, AMatrix b) {
assert(a.columns == b.rows && rows == a.rows && columns == b.columns);
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
double v = getF(i, j);
for (int k = 0; k < a.columns; k++) {
v -= a.getF(i, k) * b.getF(k, j);
}
setF(i, j, v);
}
}
}