class ML: Method add, continued
else if (x.h != y.h || x.w != y.w)
throw new RuntimeException(
”matrix dimensions do not match");
else {
ML result = new ML(x.h, x.w);
for (int r = 0; r < x.h; r++)
for (int c = 0; c < x.w; c++)
result.values[r][c] =
ml.add( x.values[r][c],
y.values[r][c]);
return result;
}
// end of method add
}
Previous slide
Back to first slide
View graphic version