/* VerifyThis 2016: Challenge 1: Matrix Multiplication
* Part 1: A naive matrix multiplication algorithm
* Checks that a matrix multiplication procedure is "correct", where
* correct is defined using the dot product and column extraction
* functions. The (i,j)-th entry of the product of A and B should
* be the dot product of the i-th row of A and the j-th column of B.
* Stephen Siegel
*/
#include
// upper bound on N, the size of the matrices
$input int BOUND = 3; // can go up to 16 if you have a few minutes
$input int N; // the size of the matrices
$assume(1<=N && N<=BOUND);
// some arbitrary input matrices...
$input float A0[N][N], B0[N][N], C0[N][N];
// impl: C is "out" variable
void matrixMultiply(int n, float C[][], float A[][], float B[][]) {
for (int i=0; i