2 (1) => _, 1 : vectorize ;
3 (m) => concat1(m - 1), ( _, 1 : vectorize) : #;
7 (1, m) => concat1(m), 1 : vectorize;
8 (n, m) => concat2(n - 1, m), (concat1(m), 1 : vectorize) : #;
11 make_input_matrix(n, m) = _, m : vectorize : _, n : vectorize ;
13 make_output_matrix(n, m) = concat2(n, m);
15 accumulate_vector(k) = _ <: sum(i, k, ( _, i : []));
17 get_column(k, j) = _ <: par(p, k, ( _, p : [] : _, j : [])) : concat1(k);
19 get_line(i) = _, i : [];
21 make_line(i, k, m) = par(j, m, ( get_line(i), get_column(k, j) : * : accumulate_vector(k)));
23 multiply(n, k, m) = par(i, n, make_line(i, k, m));
25 matrix_mul(n, k, m) = make_input_matrix(n, k), make_input_matrix(k, m) <: multiply(n, k, m) : make_output_matrix(n, m);
27 matrix_output(n, m) = _ <: par(i, n, ( _, i : []));
29 matrix_mul_square(n) = matrix_mul(n, n, n) : matrix_output(n, n);
31 //process = matrix_mul(3, 2, 3) : matrix_output(3, 3);
33 process = matrix_mul_square(3);