diff options
author | Yann Herklotz <git@yannherklotz.com> | 2020-06-12 18:06:50 +0100 |
---|---|---|
committer | Yann Herklotz <git@yannherklotz.com> | 2020-06-12 18:06:50 +0100 |
commit | c6f390beecfbd8d749d06e8d9b86a7754a2239c5 (patch) | |
tree | 545d0e659e97ac069c72a79edcee83613c5facfb /test | |
parent | 5f70d1627fb6d60a91dc2e93058c56e6d5c98ec2 (diff) | |
download | vericert-c6f390beecfbd8d749d06e8d9b86a7754a2239c5.tar.gz vericert-c6f390beecfbd8d749d06e8d9b86a7754a2239c5.zip |
Add matrix test
Diffstat (limited to 'test')
-rw-r--r-- | test/matrix.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/matrix.c b/test/matrix.c new file mode 100644 index 0000000..2a1a6b7 --- /dev/null +++ b/test/matrix.c @@ -0,0 +1,21 @@ +void matrix_multiply(int first[][2], int second[][2], int multiply[][2], int m, int q, int p) { + 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; + 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}}; + + matrix_multiply(f, s, m, 2, 2, 2); + return m[1][1]; +} |