Next: Interchange loops Up: Motivation: an example Previous: Performance

Accumulate into a scalar

  for (i = 0; i < 500; i++)
    for (j = 0; j < 500; j++){
      r = 0.0;
      for (k = 0; k < 500; k++){
        r += A[i][k] * B[k][j];
      }
      C[i][j] = r;
    }


Paul H J Kelly Thu Dec 4 18:15:31 GMT 1997