A fundamental numerical problem is the multiplication of two
matrices. Here we use a simple O(
) algorithm to compute C = AB,
where A, B, and C are NxN matrices. The algorithm follows directly
from the definition of matrix multiplication. To compute
, we
compute the dot product of the i-th row in A with the
jth column in B. The matrix lines are represented by Prolog
lists and the columns are obtained using the nth/2 predicate. Of
course, better algorithms exist for matrix multiplication, for example
Strassen's algorithm, but our interest here is not to work smarter
(e.g. with better algorithms) but to work harder, i.e. adding more
processing capacity.