def test_CY(benchmark, nbit): run_bench(benchmark, ops.C(ops.Y), (2, 4), nbit)
def test_CZ(benchmark, nbit): run_bench(benchmark, ops.C(ops.Z), (2, 4), nbit)
def test_CH(benchmark, nbit): run_bench(benchmark, ops.C(ops.H), (2, 4), nbit)
def test_CY(benchmark, nqubits): benchmark.group = "C-Rx(0.5)" run_bench(benchmark, ops.C(ops.Rx(0.5)), (2, 3), nqubits)
import numpy as np np.set_printoptions(precision=2) # create a main compiler engine drawing_engine = CircuitDrawer() eng = MainEngine(drawing_engine) a = eng.allocate_qubit() b = eng.allocate_qubit() c = eng.allocate_qubit() pi = 3.14 mpi = -3.14 ops.Rz(pi/2) | a ops.Rx(pi/2) | a ops.Rx(mpi) | b ops.C(ops.Z) | (b, a) ops.Rz(pi/2) | c ops.Rx(pi/2) | c ops.C(ops.Z) | (b, c) ops.Rz(mpi/2) | a ops.Rz(mpi/2) | b ops.Rx(mpi/2) | b ops.Rz(pi/2) | b ops.Rz(mpi/2) | c eng.flush() print(drawing_engine.get_latex())
def bCRot(G): return lambda qureg: ops.C(G(0.5))|(qureg[2], qureg[5])
def bCG(G): return lambda qureg: ops.C(G)|(qureg[2], qureg[5])