Skip to content

Commit

Permalink
fixed bug in BiRB Pauli sampling function
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanh6 committed Sep 7, 2023
1 parent 8b45526 commit 43b57fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
4 changes: 1 addition & 3 deletions pygsti/algorithms/randomcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3161,10 +3161,8 @@ def _stabilizer_to_all_zs(stabilizer, qubit_labels, absolute_compilation):
s_layer, p_layer = _symp.symplectic_kronecker(stab_layer)
stab_circuit = _cir.Circuit([c], editable=True)
stab_circuit.change_gate_library(absolute_compilation)

if stab_circuit.depth == 0:
stab_circuit.insert_layer_inplace([_lbl.Label(())], 0)
#stab_circuit.insert_layer_inplace([_lbl.Label((idle_name), q) for q in qubit_labels], 0)
stab_circuit.done_editing()

return s_layer, p_layer, stab_circuit
Expand Down Expand Up @@ -3348,7 +3346,7 @@ def _sample_stabilizer(pauli, sign, absolute_compilation, qubit_labels):
compiled_layer = layer.copy(editable=True)
compiled_layer.change_gate_library(absolute_compilation)
if compiled_layer.depth == 0:
stab_circuit.insert_layer_inplace([_lbl.Label(())], 0)
compiled_layer.insert_layer_inplace([_lbl.Label(())], 0)
#compiled_layer.insert_layer_inplace([_lbl.Label(idle_name, q) for q in qubit_labels], 0)

return stab_state, stab_phase, s_prep, p_prep, compiled_layer
Expand Down
10 changes: 3 additions & 7 deletions pygsti/protocols/rb.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,8 @@ def map_qubit_labels(self, mapper):
-------
MirrorRBDesign
"""
mapped_circuits_and_idealouts_by_depth = self._mapped_circuits_and_idealouts_by_depth(mapper)
mapped_qubit_labels = self._mapped_qubit_labels(mapper)

return DirectRBDesign.from_existing_circuits(mapped_circuits_and_idealouts_by_depth,
mapped_qubit_labels,
self.circuit_type, self.sampler,
Expand Down Expand Up @@ -980,12 +980,8 @@ def _init_foundation(self, depths, circuit_lists, measurements, signs, circuits_
self.addlocal = addlocal
self.lsargs = lsargs

if add_default_protocol:
if randomizeout:
defaultfit = 'A-fixed'
else:
defaultfit = 'full'
self.add_default_protocol(RB(name='RB', defaultfit=defaultfit))
defaultfit = 'A-fixed'
self.add_default_protocol(RB(name='RB', defaultfit=defaultfit))

self.auxfile_types['signs'] = 'json' # Makes sure that signs and measurements are saved seperately
self.auxfile_types['measurements'] = 'json'
Expand Down

0 comments on commit 43b57fe

Please sign in to comment.