-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Identity is a unitary. We probably want an explicit representation for it in cirq.
Rationale:
- Many expressions evaluate to the identity exactly (e.g. composition of H with H) or up to global phase (e.g. composition of X, Y and Z). Code that detects and optimizes such expressions may need to return identity explicitly.
- Identity is a convenient initializer for reduce-like operations on gates.
- It's directly useful in expressions for quantum channels (see e.g. Powering vector of pauli components #1037).
- It's one of the basis elements in the Pauli basis of the space of hermitian operators. Having explicit representation for it simplifies code for Representing Hamiltonians #491.
- There are currently multiple hacky ways of specifying the identity (e.g.
cirq.Y**0
). If an explicit, elegant way (e.g.cirq.I
orcirq.Identity
) is provided, the users are more likely to eschew the hacky expressions.
Some things to consider in implementation:
- It should be removed by all decompositions.
- It should compare equal to expressions such as
cirq.Z**0
orcirq.Rx(rads=0)
. - Do we need a gate for changing global phase? If so, that gate should probably be implemented simply as a phase factor for identity.
- Circuits such as
0: ───X^0───
1: ───Y─────
should display as
0: ─────────
1: ───Y─────
or
1: ───Y───
Metadata
Metadata
Assignees
Labels
No labels