diff options
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; +} |