def concurrently(a: qreg, b: qreg): with concur: X90(a) Y90(b) with concur: X90(a) Y90(b)
def main(): q1 = QubitFactory('q1') q2 = QubitFactory('q2') X90(q1) Y90(q2)
def main(): q1 = QubitFactory('q1') q2 = QubitFactory('q2') q3 = QubitFactory('q3') X90(q1) Y90(q2) Utheta(q3)
def classical_break(): q1 = QRegister("q1") for ct in range(3): X(q1) if ct >= 1: X90(q1) break X90(q1) Y90(q1)
def runtime_continue(): q1 = QRegister("q1") for ct in range(3): m = MEAS(q1) if m: X90(q1) # this should produce an error continue Y90(q1)
def classical_continue(): q1 = QRegister("q1") for ct in range(3): X(q1) if ct >= 1: X90(q1) continue X90(q1) Y90(q1)
def spam_seqs(angle, q: qreg, maxSpamBlocks=10): for rep in range(maxSpamBlocks): init(q) Y90(q) for _ in range(rep): X(q) U(q, phase=pi / 2 + angle) X(q) U(q, phase=pi / 2 + angle) X90(q) MEAS(q)
def flipflop_seqs(dragScaling, maxNumFFs, qubit: qreg): """ Helper function to create a list of sequences with a specified drag parameter. """ # QGL2 qubits are read only. # So instead, supply the dragScaling as an explicit kwarg to all pulses # qubit.pulse_params['dragScaling'] = dragScaling for rep in range(maxNumFFs): init(qubit) X90(qubit, dragScaling=dragScaling) for _ in range(rep): X90(qubit, dragScaling=dragScaling) X90m(qubit, dragScaling=dragScaling) Y90(qubit, dragScaling=dragScaling) MEAS(qubit)
def spam_seqs(angle, qubit: qreg, maxSpamBlocks=10): """ Helper function to create a list of sequences increasing SPAM blocks with a given angle. """ #SPAMBlock = [X(qubit), U(qubit, phase=pi/2+angle), X(qubit), U(qubit, phase=pi/2+angle)] #return [[Y90(qubit)] + SPAMBlock*rep + [X90(qubit)] for rep in range(maxSpamBlocks)] for rep in range(maxSpamBlocks): init(qubit) Y90(qubit) for _ in range(rep): X(qubit) U(qubit, phase=pi / 2 + angle) X(qubit) U(qubit, phase=pi / 2 + angle) X90(qubit) MEAS(qubit)
def flipflop_seqs(dragParam, maxNumFFs, qubit: qreg): """ Helper function to create a list of sequences with a specified drag parameter. """ # QGL2 qubits are read only. # So instead, supply the dragScaling as an explicit kwarg to all pulses # qubit.pulse_params['dragScaling'] = dragParam for rep in range(maxNumFFs): init(qubit) X90(qubit, dragScaling=dragParam) # FIXME: Original used [X90] + [X90, X90m]... is this right? for _ in range(rep): X90(qubit, dragScaling=dragParam) X90m(qubit, dragScaling=dragParam) Y90(qubit, dragScaling=dragParam) MEAS(qubit)
def test_loops(a: qbit, b: qbit): with concur: while True: v1 = MEAS(a) if v1: break X90(a, 1.0, 2.0) X90(a, 1.0, 2.0) while True: v2 = MEAS(b) if v2: break Y90(b)
def test_loops(a: qreg, b: qreg): x = QubitFactory("1") # Next line causes an error - qbit reassignment x = r # Next line is also an error - no d defined v1 = MEAS(d) with concur: while True: v1 = MEAS(d) # There's no qbit1 - another error X90(qbit1) if v1: break while True: v2 = MEAS(b) Y90(qbit2) if v2: break with concur: print('fred')
def sequential(a: qreg, b: qreg): X90(a) Y90(b)
def third_level(a: qreg, b: qreg): with concur: X90(a) Y90(b)
def hadamard(q: qreg): Y90(q) X(q)
def func_d(a: qreg, x: classical): Id(a) + Y90(a, kwarg1=x)
def Hadamard(q: qreg): Y90(q) X90(q)
def process(control: qreg, target: qreg): X90(control) Y90(target)
def Y90X90(q: qreg): # pulse pairs around orthogonal axes with 1e error sensititivity Y90(q) X90(q)
def func_e(a: qreg, x: classical, n: classical): for m in range(100, 102): mark2(a, n, m) Id(a) + Y90(a, kwarg1=x)
def Y90X(q: qreg): # pulse pairs with 2e sensitivity Y90(q) X(q)
def func_b(a: qreg) -> pulse: X90(a) Y90(a)
def func_c(a: qreg, x: classical): X90(a, kwarg1=x) + Y90(a, kwarg1=x)
def Y90Id(q: qreg): # single pulses Y90(q) Id(q)
def YY90(q: qreg): # pulse pairs around common axis with 3e error sensitivity Y(q) Y90(q)
def Y90Y90(q: qreg): # pulse pairs Y90(q) Y90(q)
def t1(q_a: qreg, q_b: qreg): with concur: X(q_a) + X90(q_a) + Y90(q_a) Y(q_b) + Y90(q_b) + X90(q_b)
def XY90(q: qreg): # pulse pairs with 2e sensitivity X(q) Y90(q)