示例#1
0
def concurrently(a: qreg, b: qreg):
    with concur:
        X90(a)
        Y90(b)
    with concur:
        X90(a)
        Y90(b)
示例#2
0
def main():

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

    X90(q1)
    Y90(q2)
示例#3
0
文件: b2.py 项目: stjordanis/pyqgl2
def main():

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

    X90(q1)
    Y90(q2)
    Utheta(q3)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#9
0
文件: SPAM.py 项目: stjordanis/pyqgl2
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)
示例#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)
示例#11
0
文件: ex0.py 项目: stjordanis/pyqgl2
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)
示例#12
0
文件: ex1.py 项目: stjordanis/pyqgl2
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')
示例#13
0
文件: b4.py 项目: stjordanis/pyqgl2
def sequential(a: qreg, b: qreg):
    X90(a)
    Y90(b)
示例#14
0
def third_level(a: qreg, b: qreg):
    with concur:
        X90(a)
        Y90(b)
示例#15
0
文件: qft.py 项目: stjordanis/pyqgl2
def hadamard(q: qreg):
    Y90(q)
    X(q)
示例#16
0
文件: for2.py 项目: stjordanis/pyqgl2
def func_d(a: qreg, x: classical):
    Id(a) + Y90(a, kwarg1=x)
示例#17
0
def Hadamard(q: qreg):
    Y90(q)
    X90(q)
示例#18
0
def process(control: qreg, target: qreg):
    X90(control)
    Y90(target)
示例#19
0
def Y90X90(q: qreg):
    # pulse pairs around orthogonal axes with 1e error sensititivity
    Y90(q)
    X90(q)
示例#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)
示例#21
0
def Y90X(q: qreg):
    # pulse pairs with 2e sensitivity
    Y90(q)
    X(q)
示例#22
0
def func_b(a: qreg) -> pulse:
    X90(a)
    Y90(a)
示例#23
0
def func_c(a: qreg, x: classical):
    X90(a, kwarg1=x) + Y90(a, kwarg1=x)
示例#24
0
def Y90Id(q: qreg):
    # single pulses
    Y90(q)
    Id(q)
示例#25
0
def YY90(q: qreg):
    # pulse pairs around common axis with 3e error sensitivity
    Y(q)
    Y90(q)
示例#26
0
def Y90Y90(q: qreg):
    # pulse pairs
    Y90(q)
    Y90(q)
示例#27
0
文件: t0.py 项目: stjordanis/pyqgl2
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)
示例#28
0
def XY90(q: qreg):
    # pulse pairs with 2e sensitivity
    X(q)
    Y90(q)