Skip to content

Commit

Permalink
Merge branch 'main' into fix_package_compat
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuo-ozu authored Oct 25, 2024
2 parents 09c4627 + ade0b56 commit 4f8193c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
13 changes: 13 additions & 0 deletions packages/circuit/tests/circuit/test_circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ def test_add(self) -> None:
assert isinstance(combined_circuit, QuantumCircuit)
assert combined_circuit.gates == exp_circuit.gates

def test_compare_pauli_rot(self) -> None:
circuit1 = QuantumCircuit(3)
circuit2 = QuantumCircuit(3)
circuit1.add_H_gate(0)
circuit1.add_PauliRotation_gate([1, 2], [1, 1], 2)
circuit1.add_PauliRotation_gate([0, 1, 2], [3, 1, 1], -2)
circuit1.add_H_gate(0)
circuit2.add_H_gate(0)
circuit2.add_PauliRotation_gate([1, 2], [1, 1], 2)
circuit2.add_PauliRotation_gate([1, 0, 2], [1, 3, 1], -2)
circuit2.add_H_gate(0)
assert circuit1 == circuit2


class TestQuantumCircuitDeprecation:
def test_order_flip(self) -> None:
Expand Down
8 changes: 7 additions & 1 deletion packages/rust/src/circuit/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ impl PartialEq for ImmutableQuantumCircuit {
fn eq(&self, other: &Self) -> bool {
self.qubit_count == other.qubit_count
&& self.cbit_count == other.cbit_count
&& &self.gates == &other.gates
&& &self.gates.0.len() == &other.gates.0.len()
&& self
.gates
.0
.iter()
.zip(&other.gates.0)
.all(|(l, r)| l.clone().into_property() == r.clone().into_property())
}
}

Expand Down

0 comments on commit 4f8193c

Please sign in to comment.