Skip to content

Instantly share code, notes, and snippets.

@MattDiesel
Created November 19, 2015 16:57
Show Gist options
  • Save MattDiesel/c99c9839b7a05d4837d3 to your computer and use it in GitHub Desktop.
Save MattDiesel/c99c9839b7a05d4837d3 to your computer and use it in GitHub Desktop.
#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