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

Adding dimension property to comparison of XPowGate and ZPowGate #6005

Merged
merged 15 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix code style
  • Loading branch information
joesho112358 committed Feb 14, 2023
commit 25326cd31286a729a94b52371d13ebb01755e1d4
1 change: 1 addition & 0 deletions cirq-core/cirq/ops/common_gates.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ def _json_dict_(self) -> Dict[str, Any]:
def _value_equality_values_(self):
return self._canonical_exponent, self._global_shift, self._dimension


class Rx(XPowGate):
r"""A gate with matrix $e^{-i X t/2}$ that rotates around the X axis of the Bloch sphere by $t$.

Expand Down
1 change: 1 addition & 0 deletions cirq-core/cirq/ops/common_gates_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,7 @@ def test_wrong_dims():
with pytest.raises(ValueError, match='Wrong shape'):
_ = cirq.Z.on(cirq.LineQid(0, dimension=3))


def test_json():
dimension = 3
x3 = cirq.XPowGate(dimension=dimension)
Expand Down