diff options
author | Yuri Victorovich <yuri@FreeBSD.org> | 2021-07-28 09:45:20 -0700 |
---|---|---|
committer | Yuri Victorovich <yuri@FreeBSD.org> | 2021-07-28 10:13:45 -0700 |
commit | f792513defb00a4066d4c0705ca17576e20584d6 (patch) | |
tree | 663f5e3d113320664d1b78c9862e3753acd56138 /science/py-cirq-ionq/files/example.py | |
parent | net-p2p/bitmark: Update to version 0.13.3 and modernize (diff) |
science/py-cirq-{aqt,ionq,pasqal}: New ports: Modules for the Cirq quantum computing framework
Diffstat (limited to 'science/py-cirq-ionq/files/example.py')
-rw-r--r-- | science/py-cirq-ionq/files/example.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/science/py-cirq-ionq/files/example.py b/science/py-cirq-ionq/files/example.py new file mode 100644 index 000000000000..d93432d5d3bf --- /dev/null +++ b/science/py-cirq-ionq/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) |