Skip to content

Commit

Permalink
Only update index map when needed (#1697)
Browse files Browse the repository at this point in the history
  • Loading branch information
cqc-alec authored Nov 27, 2024
1 parent a5f3169 commit 01643fe
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pytket/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def requirements(self):
self.requires("pybind11_json/0.2.14")
self.requires("symengine/0.13.0")
self.requires("tkassert/0.3.4@tket/stable")
self.requires("tket/1.3.50@tket/stable")
self.requires("tket/1.3.51@tket/stable")
self.requires("tklog/0.3.3@tket/stable")
self.requires("tkrng/0.3.3@tket/stable")
self.requires("tktokenswap/0.3.9@tket/stable")
Expand Down
2 changes: 1 addition & 1 deletion tket/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

class TketConan(ConanFile):
name = "tket"
version = "1.3.50"
version = "1.3.51"
package_type = "library"
license = "Apache 2"
homepage = "https://github.com/CQCL/tket"
Expand Down
3 changes: 3 additions & 0 deletions tket/include/tket/Transformations/CliffordReductionPass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ class CliffordReductionPass {
/** The circuit under transformation */
Circuit ˆ

/** Topological-order-respecting map from circuit vertices to integers */
IndexMap im;

/** Table of potential transports of 2qb interactions through the circuit */
interaction_table_t itable;

Expand Down
3 changes: 2 additions & 1 deletion tket/src/Transformations/CliffordReductionPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ std::optional<InteractionMatch> CliffordReductionPass::search_back_for_match(
point[0] = rip0;
point[1] = rip1;
std::map<Edge, RevInteractionPoint> point_lookup;
IndexMap im = circ.index_map();

// interactions met when commuting back; point lists are in causal order of
// circuit:
Expand Down Expand Up @@ -350,6 +349,7 @@ void CliffordReductionPass::process_new_interaction(const Vertex &inter) {
break;
}
}
im = circ.index_map();
success = true;
} else {
std::vector<std::optional<Edge>> outs = circ.get_linear_out_edges(v);
Expand Down Expand Up @@ -645,6 +645,7 @@ CliffordReductionPass::valid_insertion_point(

CliffordReductionPass::CliffordReductionPass(Circuit &c, bool swaps)
: circ(c),
im(c.index_map()),
itable(),
v_to_depth(),
success(false),
Expand Down

0 comments on commit 01643fe

Please sign in to comment.