コード例 #1
0
def anotherMulti2():
    qs = QRegister(3)
    qsub = QRegister(qs[0], qs[1])
    Id(qsub)
    X(qs[0:2])  # equivalent to calling with qsub argument
    Barrier(qs)
    MEAS(qsub)
    Barrier(qs)
    Y(qs[0])
    Y(qs[2])
コード例 #2
0
def anotherMulti3():
    qs = QRegister(3)
    # create the QRegister with slicing
    qsub = QRegister(qs[0:2])
    Id(qsub)
    X(qsub)
    Barrier(qs)
    MEAS(qsub)
    Barrier(qs)
    Y(qs[0])
    Y(qs[2])
コード例 #3
0
def measConcurrently(listNQubits: qreg) -> pulse:
    '''Concurrently measure given QRegister of qubits.
    Note: Includes a Barrier on the input qreg to force measurements
    to be concurrent; QGL1 does Pulse*Pulse == PulseBlock(pulses), which is equivalent.'''
    qr = QRegister(listNQubits)
    Barrier(qr)
    MEAS(qr)
コード例 #4
0
def anotherMulti():
    qs = QRegister(2)
    Id(qs)
    X(qs)
    Barrier(qs)
    MEAS(qs)
    Y(qs)
コード例 #5
0
def multiQbitTest2():
    qs = QRegister('q1', 'q2')

    Id(qs)
    X(qs)
    Barrier(qs)
    MEAS(qs)
コード例 #6
0
def create_cal_seqs(qubits: qreg,
                    numRepeats,
                    measChans=None,
                    waitcmp=False,
                    delay=None):
    """
    Helper function to create a set of calibration sequences.

    Parameters
    ----------
    qubits : a QRegister of channels to calibrate
    numRepeats : number of times to repeat calibration sequences (int)
    measChans : QRegister of channels to measure; default is to use qubits
    waitcmp = True if the sequence contains branching; default False
    delay: optional time between state preparation and measurement (s)
    """
    # Allows supplying a tuple as is usually done in QGL1
    qubitreg = QRegister(qubits)

    # QGL2 will warn here:
    # warning: parameter [measChans] overwritten by assignment
    if measChans is None:
        measChans = qubitreg

    # Make all combinations for qubit calibration states for n qubits and repeat

    # Assuming numRepeats=2 and qubits are q1, q2
    # Produces 2 ^ #qubits * numRepeats sequences of Id, X, MEAS,
    # something like
    # [[Id(q1)*Id(q2), M(q1)*M(q2)], [Id(q1)*Id(q2), M(q1)*M(q2)],
    #  [Id(q1)*X(q2), M(q1)*M(q2)],  [Id(q1)*X(q2), M(q1)*M(q2)],
    #  [X(q1)*Id(q2), M(q1)*M(q2)],  [X(q1)*Id(q2), M(q1)*M(q2)],
    #  [X(q1)*X(q2), M(q1)*M(q2)],   [X(q1)*X(q2), M(q1)*M(q2)]]

    # Calibrate using Id and X pulses
    calSet = [Id, X]

    for pulseSet in product(calSet, repeat=len(qubitreg)):
        # Repeat each calibration numRepeats times
        for _ in range(numRepeats):
            init(qubitreg)
            for pulse, qubit in zip(pulseSet, qubitreg):
                pulse(qubit)
            if delay:
                # Add optional delay before measurement
                Id(qubitreg(0), length=delay)
            Barrier(measChans)
            MEAS(measChans)
            # If branching do wait
            if waitcmp:
                qwait(kind='CMP')
コード例 #7
0
ファイル: helpers.py プロジェクト: DebasishMaji/pyqgl2
def measConcurrently(listNQubits: qreg) -> pulse:
    '''Concurrently measure given QRegister of qubits.'''
    qr = QRegister(listNQubits)
    Barrier(qr)
    MEAS(qr)