diff options
author | Michael Abed <michaelabed@gmail.com> | 2012-04-09 01:45:23 -0400 |
---|---|---|
committer | Michael Abed <michaelabed@gmail.com> | 2012-04-09 01:48:41 -0400 |
commit | 1ba0668dbcf5bc4c40d99ac963711e35797c8efa (patch) | |
tree | b359b81f4e538e923366a7c718d9defd9b823bc4 /MatrixMultiply.cpp | |
download | ec327-lab3-master.tar.gz ec327-lab3-master.tar.bz2 ec327-lab3-master.zip |
Diffstat (limited to 'MatrixMultiply.cpp')
-rw-r--r-- | MatrixMultiply.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/MatrixMultiply.cpp b/MatrixMultiply.cpp new file mode 100644 index 0000000..520f930 --- /dev/null +++ b/MatrixMultiply.cpp @@ -0,0 +1,25 @@ + +#include "MatrixMultiply.h" + +double** matrixmultiply(double *m1[], double *m2[]) +{ + const int inner = 3; + const int o1 = 3; + const int o2 = 2; + int i; + + double **result = new double*[ o1 ]; + for (int i = 0; i < 3; i++) { + result[i] = new double[o2]; + } + + for (i = 0; i < o1; i++) { + for (int j = 0; j < o2; j++) { + result[i][j] = 0; + for(int k = 0; k < inner; k++) { + result[i][j] += m1[i][k]*m2[k][j]; + } + } + } + return result; +} |