diff --git a/src/stim/stabilizers/pauli_string_ref.inl b/src/stim/stabilizers/pauli_string_ref.inl index 5d8a9599..943b6763 100644 --- a/src/stim/stabilizers/pauli_string_ref.inl +++ b/src/stim/stabilizers/pauli_string_ref.inl @@ -883,9 +883,9 @@ template void PauliStringRef::do_ZCX(const CircuitInstruction &inst) { const auto &targets = inst.targets; assert((targets.size() & 1) == 0); - for (size_t k = 0; k < inst.targets.size(); k += 2) { - size_t k2 = reverse_order ? inst.targets.size() - 2 - k : k; - size_t q1 = inst.targets[k2].data, q2 = inst.targets[k2 + 1].data; + for (size_t k = 0; k < targets.size(); k += 2) { + size_t k2 = reverse_order ? targets.size() - 2 - k : k; + size_t q1 = targets[k2].data, q2 = targets[k2 + 1].data; do_single_cx(inst, q1, q2); } } @@ -895,9 +895,9 @@ template void PauliStringRef::do_ZCY(const CircuitInstruction &inst) { const auto &targets = inst.targets; assert((targets.size() & 1) == 0); - for (size_t k = 0; k < inst.targets.size(); k += 2) { - size_t k2 = reverse_order ? inst.targets.size() - 2 - k : k; - size_t q1 = inst.targets[k2].data, q2 = inst.targets[k2 + 1].data; + for (size_t k = 0; k < targets.size(); k += 2) { + size_t k2 = reverse_order ? targets.size() - 2 - k : k; + size_t q1 = targets[k2].data, q2 = targets[k2 + 1].data; do_single_cy(inst, q1, q2); } } @@ -916,9 +916,9 @@ template void PauliStringRef::do_SWAP(const CircuitInstruction &inst) { const auto &targets = inst.targets; assert((targets.size() & 1) == 0); - for (size_t k = 0; k < inst.targets.size(); k += 2) { - size_t k2 = reverse_order ? inst.targets.size() - 2 - k : k; - size_t q1 = inst.targets[k2].data, q2 = inst.targets[k2 + 1].data; + for (size_t k = 0; k < targets.size(); k += 2) { + size_t k2 = reverse_order ? targets.size() - 2 - k : k; + size_t q1 = targets[k2].data, q2 = targets[k2 + 1].data; zs[q1].swap_with(zs[q2]); xs[q1].swap_with(xs[q2]); } diff --git a/src/stim/util_top/dem_to_matrix.cc b/src/stim/util_top/dem_to_matrix.cc index f057ad59..6544968b 100644 --- a/src/stim/util_top/dem_to_matrix.cc +++ b/src/stim/util_top/dem_to_matrix.cc @@ -15,7 +15,7 @@ std::map, double> stim::dem_to_map(const DetectorErrorMo buf.sorted_items.push_back(t); } } - size_t kept = xor_sort(buf); + size_t kept = xor_sort(buf.sorted_items); buf.sorted_items.resize(kept); auto q = instruction.arg_data[0]; auto &p = result[buf];