Ejemplo n.º 1
0
def concurrently(a: qreg, b: qreg):
    with concur:
        X90(a)
        Y90(b)
    with concur:
        X90(a)
        Y90(b)
Ejemplo n.º 2
0
def main():

    q1 = QubitFactory('q1')
    q2 = QubitFactory('q2')

    X90(q1)
    Y90(q2)
Ejemplo n.º 3
0
def main():

    q1 = QubitFactory('q1')
    q2 = QubitFactory('q2')
    q3 = QubitFactory('q3')

    X90(q1)
    Y90(q2)
    Utheta(q3)
Ejemplo n.º 4
0
def classical_break():
    q1 = QRegister("q1")

    for ct in range(3):
        X(q1)
        if ct >= 1:
            X90(q1)
            break
            X90(q1)
        Y90(q1)
Ejemplo n.º 5
0
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)
Ejemplo n.º 6
0
def classical_continue():
    q1 = QRegister("q1")

    for ct in range(3):
        X(q1)
        if ct >= 1:
            X90(q1)
            continue
            X90(q1)
        Y90(q1)
Ejemplo n.º 7
0
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)
Ejemplo n.º 8
0
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)
Ejemplo n.º 9
0
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)
Ejemplo n.º 10
0
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)
Ejemplo n.º 11
0
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)
Ejemplo n.º 12
0
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')
Ejemplo n.º 13
0
def sequential(a: qreg, b: qreg):
    X90(a)
    Y90(b)
Ejemplo n.º 14
0
def third_level(a: qreg, b: qreg):
    with concur:
        X90(a)
        Y90(b)
Ejemplo n.º 15
0
def hadamard(q: qreg):
    Y90(q)
    X(q)
Ejemplo n.º 16
0
def func_d(a: qreg, x: classical):
    Id(a) + Y90(a, kwarg1=x)
Ejemplo n.º 17
0
def Hadamard(q: qreg):
    Y90(q)
    X90(q)
Ejemplo n.º 18
0
def process(control: qreg, target: qreg):
    X90(control)
    Y90(target)
Ejemplo n.º 19
0
def Y90X90(q: qreg):
    # pulse pairs around orthogonal axes with 1e error sensititivity
    Y90(q)
    X90(q)
Ejemplo n.º 20
0
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)
Ejemplo n.º 21
0
def Y90X(q: qreg):
    # pulse pairs with 2e sensitivity
    Y90(q)
    X(q)
Ejemplo n.º 22
0
def func_b(a: qreg) -> pulse:
    X90(a)
    Y90(a)
Ejemplo n.º 23
0
def func_c(a: qreg, x: classical):
    X90(a, kwarg1=x) + Y90(a, kwarg1=x)
Ejemplo n.º 24
0
def Y90Id(q: qreg):
    # single pulses
    Y90(q)
    Id(q)
Ejemplo n.º 25
0
def YY90(q: qreg):
    # pulse pairs around common axis with 3e error sensitivity
    Y(q)
    Y90(q)
Ejemplo n.º 26
0
def Y90Y90(q: qreg):
    # pulse pairs
    Y90(q)
    Y90(q)
Ejemplo n.º 27
0
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)
Ejemplo n.º 28
0
def XY90(q: qreg):
    # pulse pairs with 2e sensitivity
    X(q)
    Y90(q)