aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNadesh Ramanathan <nadeshramanathan88@gmail.com>2020-06-13 12:28:52 +0100
committerNadesh Ramanathan <nadeshramanathan88@gmail.com>2020-06-13 12:28:52 +0100
commit4b49703d9fd74ed3e8143683ade5f5849d97787b (patch)
tree422727f3dd81c8e572142066b677d0f40c31bc36 /test
parent339ca8ac28d585a3407f1b07be4b0d9fdbc465f7 (diff)
downloadvericert-kvx-4b49703d9fd74ed3e8143683ade5f5849d97787b.tar.gz
vericert-kvx-4b49703d9fd74ed3e8143683ade5f5849d97787b.zip
Better mm check
Diffstat (limited to 'test')
-rw-r--r--test/matrix2.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/matrix2.c b/test/matrix2.c
new file mode 100644
index 0000000..96571be
--- /dev/null
+++ b/test/matrix2.c
@@ -0,0 +1,23 @@
+void matrix_multiply(int first[][2], int second[][2], int multiply[][2], int m, int q, int p, int *totalSum) {
+ int sum = 0;
+ for (int c = 0; c < m; c++) {
+ for (int d = 0; d < q; d++) {
+ for (int k = 0; k < p; k++) {
+ sum = sum + first[c][k]*second[k][d];
+ }
+ multiply[c][d] = sum;
+ *totalSum += sum;
+ sum = 0;
+ }
+ }
+}
+
+int main() {
+ int f[2][2] = {{1, 2}, {3, 4}};
+ int s[2][2] = {{1, 2}, {3, 4}};
+ int m[2][2] = {{0, 0}, {0, 0}};
+ int sum = 0;
+
+ matrix_multiply(f, s, m, 2, 2, 2, &sum);
+ return sum;
+}