Skip to content

Commit

Permalink
clean up intersection code
Browse files Browse the repository at this point in the history
  • Loading branch information
sjdilkes committed Dec 4, 2023
1 parent a53679b commit ae92c47
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
19 changes: 9 additions & 10 deletions tket/src/Characterisation/Cycles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,15 @@ std::pair<unsigned, std::set<unsigned>> CycleFinder::make_cycle(
if (std::find(
history_uids.begin(), history_uids.end(), not_present_uid) !=
history_uids.end()) {
// => the not present uid is in this cycle
// now we check the overlap
//
for (const UnitID& a :
this->cycle_history.history[candidate_cycle_key]) {
for (const UnitID& b : history_uids) {
if (a == b) {
not_mergeable_keys.insert(candidate_cycle_key);
}
}
std::vector<UnitID> intersection;
std::vector<UnitID> candidates =
cycle_history.history[candidate_cycle_key];
std::set_intersection(
candidates.begin(), candidates.end(), history_uids.begin(),
history_uids.end(), std::back_inserter(intersection));
if (!intersection.empty()) {
not_mergeable_keys.insert(candidate_cycle_key);
break;
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions tket/src/Characterisation/FrameRandomisation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ std::string FrameRandomisation::to_string() const {
// Wires Identity gates into each cycle edge. Identity gates then relabelled
// with Ops from OpTypeSet to create instances of Frame Randomisation
void add_noop_frames(std::vector<Cycle>& cycles, Circuit& circ) {
IndexMap imap = circ.index_map();

std::map<Edge, Edge> replacement_rewiring_edges;
for (Cycle& full_cycle : cycles) {
std::vector<edge_pair_t> cycle = full_cycle.boundary_edges_;
Expand Down

0 comments on commit ae92c47

Please sign in to comment.