Created
November 19, 2015 16:57
-
-
Save MattDiesel/c99c9839b7a05d4837d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "inst_none.h" | |
const int matrixSize = 1000; | |
int a[matrixSize][matrixSize]; | |
int b[matrixSize][matrixSize]; | |
int c[matrixSize][matrixSize]; | |
int main() { | |
int i, j, k, jj, kk, r; | |
// Initialise the matrices arbitrarily | |
for (i = 0; i < matrixSize; i++) { | |
for (j = 0; j < matrixSize; j++) { | |
b[i][j] = i + j; c[i][j] = i - j; a[i][j] = 0; | |
} | |
} | |
// Work out a = b * c, using an obvious algorithm | |
for (i = 0; i < matrixSize; i++) { | |
for (j = 0; j < matrixSize; j++) { | |
INST_W(a[i][j]) = 0; | |
for (k = 0; k < matrixSize; k++) { | |
INST_W(a[i][j]) += INST_R(b[i][k]) * INST_R(c[k][j]); | |
} | |
} | |
} | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment