dot method Null safety

void dot(
  1. AMatrix a,
  2. AMatrix b
)

Computes this = a dot b. r, a and b must already be properly dimensioned.

Implementation

void dot(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 = 0;
      for (int k = 0; k < a.columns; k++) {
        v += a.getF(i, k) * b.getF(k, j);
      }
      setF(i, j, v);
    }
  }
}