aboutsummaryrefslogtreecommitdiff
path: root/tester
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-08-29 04:34:22 +0200
committerhachem <im@hachem.wtf>2026-08-29 04:34:22 +0200
commitcd69b3c1be9a515906954f48f7f1dbc582f8ad83 (patch)
tree9ef61a5c0987742be55f5edc9c42a9fc20f1812b /tester
parent94612a0be0e691d68bcd27a33e529ad30fa3df43 (diff)
add: vectors
Diffstat (limited to 'tester')
-rw-r--r--tester/main.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tester/main.c b/tester/main.c
index eb629fc..bc29bb1 100644
--- a/tester/main.c
+++ b/tester/main.c
@@ -1,6 +1,7 @@
#include <stdio.h>
#include "maths/complex.h"
+#include "maths/vector.h"
#include "psi.h"
int main(void)
@@ -19,5 +20,23 @@ int main(void)
printf("a * b = %g + %gi\n", product.real, product.imaginary);
printf("|a| = %g\n", psi_abs_complex(a));
+ struct PsiVector u = psi_column_vector(
+ psi_new_complex(1.0, 0.0),
+ psi_new_complex(2.0, 0.0),
+ psi_new_complex(3.0, 0.0));
+ struct PsiVector v = psi_column_vector(
+ psi_new_complex(4.0, 0.0),
+ psi_new_complex(5.0, 0.0),
+ psi_new_complex(6.0, 0.0));
+
+ struct PsiComplex dot = psi_dot_vector(u, v);
+ struct PsiComplex norm = psi_norm_vector(u);
+
+ printf("u . v = %g + %gi\n", dot.real, dot.imaginary);
+ printf("|u| = %g + %gi\n", norm.real, norm.imaginary);
+
+ psi_free_vector(&u);
+ psi_free_vector(&v);
+
return 0;
}