26 lines
470 B
Python
26 lines
470 B
Python
import cirq
|
|
from math import pi
|
|
|
|
|
|
def superdense():
|
|
# Pick a qubit.
|
|
q0 = cirq.GridQubit(0, 0)
|
|
|
|
# Create a circuit
|
|
circuit = cirq.Circuit(
|
|
cirq.rx(pi/8).on(q0),
|
|
cirq.rz(pi/2).on(q0),
|
|
cirq.measure(q0, key='q0'),
|
|
)
|
|
print("Circuit:")
|
|
print(circuit)
|
|
|
|
simulator = cirq.Simulator()
|
|
result = simulator.run(circuit, repetitions=100)
|
|
print("Results:")
|
|
print(result)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
superdense()
|