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

Add __eq__() method to (Parametric)QuantumGate #277

Merged
merged 3 commits into from
Dec 4, 2023
Merged

Conversation

toru4838
Copy link
Contributor

@toru4838 toru4838 commented Dec 4, 2023

Comparing two Pauli or PauliRotation gates that have equivalent matrix representation but different order of target_indice and pauli_ids gives the result we don't expect.

For example,

Pauli(target_indices=(0,1), pauli_ids=(1,2)) == Pauli(target_indices=(0,1), pauli_ids=(1,2))  # True
Pauli(target_indices=(0,1), pauli_ids=(1,2)) == Pauli(target_indices=(1,0), pauli_ids=(2,1))  # False

This PR adds __eq__() method to QuantumGate and ParametricQuantumGate that compares the pairs of target_index and pauli_id

Copy link

github-actions bot commented Dec 4, 2023

@github-actions github-actions bot temporarily deployed to pull request December 4, 2023 05:39 Inactive
Copy link
Contributor

@dchung0741 dchung0741 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dchung0741 dchung0741 merged commit 7a059f4 into main Dec 4, 2023
8 checks passed
@dchung0741 dchung0741 deleted the gate-eq-method branch December 4, 2023 05:50
@github-actions github-actions bot locked and limited conversation to collaborators Dec 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants