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

Fix FlattenRelabelRegistersPass #1441

Merged
merged 5 commits into from
Jun 7, 2024
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
2 changes: 1 addition & 1 deletion pytket/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def package(self):
cmake.install()

def requirements(self):
self.requires("tket/1.3.5@tket/stable")
self.requires("tket/1.3.6@tket/stable")
self.requires("tklog/0.3.3@tket/stable")
self.requires("tkrng/0.3.3@tket/stable")
self.requires("tkassert/0.3.4@tket/stable")
Expand Down
10 changes: 9 additions & 1 deletion pytket/tests/predicates_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Unitary2qBox,
Node,
Qubit,
Bit,
UnitID,
Conditional,
)
Expand Down Expand Up @@ -885,7 +886,10 @@ def test_conditional_phase() -> None:


def test_flatten_relabel_pass() -> None:
c = Circuit(3)
c = Circuit(3, 3)
c.add_bit(Bit("d", 0))
c.add_bit(Bit("d", 1))
c.add_c_register("e", 5)
c.H(1).H(2)
rename_map: RenameUnitsMap = dict()
rename_map[Qubit(0)] = Qubit("a", 4)
Expand All @@ -901,6 +905,10 @@ def test_flatten_relabel_pass() -> None:
assert cu.initial_map[Qubit("a", 4)] == Qubit("a", 4)
assert cu.initial_map[Qubit("b", 7)] == Qubit("a", 1)
assert cu.circuit.qubits == [Qubit("a", 0), Qubit("a", 1)]
assert cu.circuit.n_bits == 10
assert cu.circuit.get_c_register("c").size == 3
assert cu.circuit.get_c_register("d").size == 2
assert cu.circuit.get_c_register("e").size == 5

# test default argument
c = Circuit()
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.5"
version = "1.3.6"
package_type = "library"
license = "Apache 2"
homepage = "https://github.com/CQCL/tket"
Expand Down
2 changes: 1 addition & 1 deletion tket/src/Predicates/PassGenerators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ PassPtr gen_flatten_relabel_registers_pass(const std::string& label) {
Transform t =
Transform([=](Circuit& circuit, std::shared_ptr<unit_bimaps_t> maps) {
unsigned n_qubits = circuit.n_qubits();
circuit.remove_blank_wires(false);
circuit.remove_blank_wires(true);
bool changed = circuit.n_qubits() < n_qubits;
std::map<Qubit, Qubit> relabelling_map;
std::vector<Qubit> all_qubits = circuit.all_qubits();
Expand Down
Loading