From 7e093e9726d7017943f5b9c45470a2acd9024d70 Mon Sep 17 00:00:00 2001 From: hachem Date: Thu, 10 Sep 2026 20:20:14 +0200 Subject: feat: rt execution engine and circuit compute --- tester/main.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tester') diff --git a/tester/main.c b/tester/main.c index 57fc7ca..c8077e9 100644 --- a/tester/main.c +++ b/tester/main.c @@ -192,5 +192,22 @@ int main(void) psi_free_vector(&sast); psi_free_structure_aware_batch(&sa); + + struct PsiQuantumCircuit ghz = psi_new_quantum_circuit(3); + psi_apply_h(&ghz, 0); + psi_apply_cnot(&ghz, 0, 1); + psi_apply_cnot(&ghz, 1, 2); + + const struct PsiVector *ghz_state = psi_compute_circuit_with(&ghz, PSI_RUNTIME_STRUCTURE_AWARE); + printf("ghz ="); + for (size_t i = 0; i < ghz_state->size; i++) + printf(" %g", ghz_state->data[i].real); + printf("\n"); + + double probs[8]; + psi_circuit_probabilities(&ghz, probs); + printf("p(000) = %g, p(111) = %g\n", probs[0], probs[7]); + + psi_free_quantum_circuit(&ghz); } -- cgit v1.3