diff options
| author | hachem <im@hachem.wtf> | 2026-09-06 19:30:28 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-09-06 19:30:28 +0200 |
| commit | 597c959053fe8861538513663d3ca04ff8f5356b (patch) | |
| tree | b0ac8f7fb5648237eb3be0a099dd76a757cb102b /tester/main.c | |
| parent | b2a5d3d5a2faac05b1b722d96d11d9b191c7cffc (diff) | |
add: standard gate library
Diffstat (limited to 'tester/main.c')
| -rw-r--r-- | tester/main.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/tester/main.c b/tester/main.c index 8885afa..cc32de1 100644 --- a/tester/main.c +++ b/tester/main.c @@ -1,5 +1,6 @@ #include <stdio.h> +#include "core/gates.h" #include "core/quantum_components.h" #include "maths/complex.h" #include "maths/matrix.h" @@ -80,17 +81,8 @@ int main(void) const char *names[] = { "q0", "q1" }; struct PsiQuantumRegister reg = psi_new_quantum_register("bell", names, 2); - struct PsiMatrix h2 = psi_matrix(2, 2, - psi_new_complex(inv_sqrt2, 0.0), psi_new_complex(inv_sqrt2, 0.0), - psi_new_complex(inv_sqrt2, 0.0), psi_new_complex(-inv_sqrt2, 0.0)); - struct PsiQuantumGate hadamard = psi_new_quantum_gate_from_matrix("H", h2); - - struct PsiMatrix cnot_m = psi_matrix(4, 4, - psi_new_complex(1.0, 0.0), psi_new_complex(0.0, 0.0), psi_new_complex(0.0, 0.0), psi_new_complex(0.0, 0.0), - psi_new_complex(0.0, 0.0), psi_new_complex(1.0, 0.0), psi_new_complex(0.0, 0.0), psi_new_complex(0.0, 0.0), - psi_new_complex(0.0, 0.0), psi_new_complex(0.0, 0.0), psi_new_complex(0.0, 0.0), psi_new_complex(1.0, 0.0), - psi_new_complex(0.0, 0.0), psi_new_complex(0.0, 0.0), psi_new_complex(1.0, 0.0), psi_new_complex(0.0, 0.0)); - struct PsiQuantumGate cnot = psi_new_quantum_gate_from_matrix("CNOT", cnot_m); + struct PsiQuantumGate hadamard = psi_hadamard_gate(); + struct PsiQuantumGate cnot = psi_cnot_gate(); size_t t0[] = { 0 }; size_t t01[] = { 0, 1 }; |
