diff options
| author | hachem <im@hachem.wtf> | 2026-09-12 00:39:59 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-09-12 00:39:59 +0200 |
| commit | 00d22403a3ddad8692252a7974d586f32cf745bf (patch) | |
| tree | eab7fbcbdf139a61f01125770744c87e2ac548d0 /tester | |
| parent | 7e093e9726d7017943f5b9c45470a2acd9024d70 (diff) | |
feat: symbolic amplitude and probability formatting
Diffstat (limited to 'tester')
| -rw-r--r-- | tester/main.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tester/main.c b/tester/main.c index c8077e9..346b16a 100644 --- a/tester/main.c +++ b/tester/main.c @@ -208,6 +208,12 @@ int main(void) psi_circuit_probabilities(&ghz, probs); printf("p(000) = %g, p(111) = %g\n", probs[0], probs[7]); + char abuf[64]; + char pbuf[64]; + printf("amp = |000> %s, p|111> %s\n", + psi_format_amplitude(ghz_state->data[0], abuf, sizeof abuf), + psi_format_probability(probs[7], pbuf, sizeof pbuf)); + psi_free_quantum_circuit(&ghz); } |
