diff options
| author | Lexi Winter <ivy@FreeBSD.org> | 2025-12-01 03:19:41 +0000 |
|---|---|---|
| committer | Lexi Winter <ivy@FreeBSD.org> | 2025-12-01 03:19:41 +0000 |
| commit | 2e80774d0b20d167bc0a9e2b63dafbfb171c0d22 (patch) | |
| tree | 25f0138e1af8902b92dacc8cce09b267447c17db /science/py-cirq-web/files/example.py | |
| parent | f85f2b2d6e5b7ed869376eb4b180c3a74a5c5da9 (diff) | |
| parent | 1a30da80670973368b399f2b01fe9c04b91a1273 (diff) | |
Merge remote-tracking branch 'freebsd/main' into lf/mainlf/main
Diffstat (limited to 'science/py-cirq-web/files/example.py')
| -rw-r--r-- | science/py-cirq-web/files/example.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/science/py-cirq-web/files/example.py b/science/py-cirq-web/files/example.py new file mode 100644 index 000000000000..d93432d5d3bf --- /dev/null +++ b/science/py-cirq-web/files/example.py @@ -0,0 +1,18 @@ +import cirq + +# Pick a qubit. +qubit = cirq.GridQubit(0, 0) + +# Create a circuit +circuit = cirq.Circuit( + cirq.X(qubit)**0.5, # Square root of NOT. + cirq.measure(qubit, key='m') # Measurement. +) +print("Circuit:") +print(circuit) + +# Simulate the circuit several times. +simulator = cirq.Simulator() +result = simulator.run(circuit, repetitions=20) +print("Results:") +print(result) |
