aboutsummaryrefslogtreecommitdiff
path: root/tester
diff options
context:
space:
mode:
Diffstat (limited to 'tester')
-rw-r--r--tester/main.c17
1 files changed, 17 insertions, 0 deletions
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);
}