aboutsummaryrefslogtreecommitdiffstats
path: root/test/matrix.c
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2020-06-30 19:52:59 +0100
committerYann Herklotz <git@yannherklotz.com>2020-06-30 19:52:59 +0100
commitf8ff27915f8c4d5fb6f31ec2a0a73f65cf604c43 (patch)
treee1186fac9de9c83ba0d0d0bc43bb9ac0fe86ef26 /test/matrix.c
parentf26f3887d0b0ac286c317a5425a3a4781871cfc2 (diff)
downloadvericert-kvx-f8ff27915f8c4d5fb6f31ec2a0a73f65cf604c43.tar.gz
vericert-kvx-f8ff27915f8c4d5fb6f31ec2a0a73f65cf604c43.zip
Add htl pretty printing
Diffstat (limited to 'test/matrix.c')
-rw-r--r--test/matrix.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/test/matrix.c b/test/matrix.c
index 2bb17e7..daa00ae 100644
--- a/test/matrix.c
+++ b/test/matrix.c
@@ -1,10 +1,8 @@
-#define N 4
-
-void matrix_multiply(int first[N][N], int second[N][N], int multiply[N][N]) {
+void matrix_multiply(int first[2][2], int second[2][2], int multiply[2][2]) {
int sum = 0;
- for (int c = 0; c < N; c++) {
- for (int d = 0; d < N; d++) {
- for (int k = 0; k < N; k++) {
+ for (int c = 0; c < 2; c++) {
+ for (int d = 0; d < 2; d++) {
+ for (int k = 0; k < 2; k++) {
sum = sum + first[c][k]*second[k][d];
}
multiply[c][d] = sum;
@@ -14,9 +12,9 @@ void matrix_multiply(int first[N][N], int second[N][N], int multiply[N][N]) {
}
int main() {
- int f[N][N] = {{1, 2, 3, 4}, {1, 2, 3, 4}, {1, 2, 3, 4}, {1, 2, 3, 4}};
- int s[N][N] = {{5, 6, 7, 8}, {5, 6, 7, 8}, {5, 6, 7, 8}, {5, 6, 7, 8}};
- int m[N][N] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};
+ int f[2][2] = {{1, 2}, {3, 4}};
+ int s[2][2] = {{5, 6}, {7, 8}};
+ int m[2][2] = {{0, 0}, {0, 0}};
matrix_multiply(f, s, m);
return m[1][1];