## Matrix addition:

Procs2 p = new Procs2(2, 3);

on(p) {

Range x = new BlockRange(N, p.dim(0));

Range y = new BlockRange(N, p.dim(1));

float [[,]] a = new float [[x, y]], b = new float [[x, y]],

c = new float [[x, y]];

. . . initialize values in ‘a’, ‘b’

overall (i = x for :)

overall (j = y for :)

c[i, j] = a[i, j] + b[i, j];

}

Previous slide | Next slide | Back to first slide | View graphic version |