Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc. Invalidate and RB fixes #203

Merged
merged 2 commits into from
Apr 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions QGL/BasicSequences/Feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ def BitFlip3(data_qs, ancilla_qs, theta=None, phi=None, nrounds=1, meas_delay=1e
raise Exception("Wrong number of qubits")
seqs = [
DecodeSetRounds(1,0,nrounds),
Invalidate(addr=10, mask=2*nrounds),
Invalidate(addr=11, mask=0x1)]
Invalidate(10, 2*nrounds),
Invalidate(11, 0x1)]

# encode single-qubit state into 3 qubits
if theta and phi:
Expand Down
12 changes: 8 additions & 4 deletions QGL/BasicSequences/RB.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def SingleQubitRB(qubit, seqs, purity=False, showPlot=False, add_cals=True):
return metafile


def TwoQubitRB(q1, q2, seqs, showPlot=False, suffix="", add_cals=True):
def TwoQubitRB(q1, q2, seqs, showPlot=False, suffix="", add_cals=True, measChans = None):
"""Two qubit randomized benchmarking using 90 and 180 single qubit generators and ZX90

Parameters
Expand All @@ -97,14 +97,18 @@ def TwoQubitRB(q1, q2, seqs, showPlot=False, suffix="", add_cals=True):
showPlot : whether to plot (boolean)
suffix : suffix to apply to sequence file names
"""
if measChans is None:
measChans = (q1,q2)

seqsBis = []
for seq in seqs:
seqsBis.append(reduce(operator.add, [clifford_seq(c, q2, q1)
for c in seq]))

measBlock = reduce(operator.mul, [MEAS(q) for q in measChans])
#Add the measurement to all sequences
for seq in seqsBis:
seq.append(MEAS(q1) * MEAS(q2))
seq.append(measBlock)

axis_descriptor = [{
'name': 'length',
Expand All @@ -115,8 +119,8 @@ def TwoQubitRB(q1, q2, seqs, showPlot=False, suffix="", add_cals=True):

#Tack on the calibration sequences
if add_cals:
seqsBis += create_cal_seqs((q1, q2), 2)
axis_descriptor.append(cal_descriptor((q1, q2), 2))
seqsBis += create_cal_seqs(measChans, 2)
axis_descriptor.append(cal_descriptor(measChans, 2))

metafile = compile_to_hardware(seqsBis, 'RB/RB', axis_descriptor = axis_descriptor, suffix = suffix, extra_meta = {'sequences':seqs})

Expand Down