question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Identity is a unitary. We probably want an explicit representation for it in cirq.

Rationale:

  1. 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.
  2. Identity is a convenient initializer for reduce-like operations on gates.
  3. It’s directly useful in expressions for quantum channels (see e.g. #1037).
  4. 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 #491.
  5. There are currently multiple hacky ways of specifying the identity (e.g. cirq.Y**0). If an explicit, elegant way (e.g. cirq.I or cirq.Identity) is provided, the users are more likely to eschew the hacky expressions.

Some things to consider in implementation:

  1. It should be removed by all decompositions.
  2. It should compare equal to expressions such as cirq.Z**0 or cirq.Rx(rads=0).
  3. Do we need a gate for changing global phase? If so, that gate should probably be implemented simply as a phase factor for identity.
  4. Circuits such as
0: ───X^0───

1: ───Y─────

should display as

0: ─────────

1: ───Y─────

or

1: ───Y───

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dabaconcommented, Jan 31, 2019

I think displaying it as empty isn’t quite correct? Putting identity gates into a Moment is sort of saying "do nothing here and block anything else from happening here). If you don’t show it then you will end up having odd things where you don’t see that the identity gate is in a particular location.

0reactions
Strilanccommented, Nov 14, 2019

Already done

Read more comments on GitHub >

github_iconTop Results From Across the Web

Single Qubit Gates - Qiskit
First comes the I-gate (aka 'Id-gate' or 'Identity gate'). This is simply a gate that does nothing. Its matrix is the identity matrix:....
Read more >
Quantum logic gate - Wikipedia
In quantum computing and specifically the quantum circuit model of computation, a quantum ... The identity gate is the identity matrix, usually written...
Read more >
All the quantum gate identities fit for print - Chris Ferrie - Medium
All the quantum gate identities fit for print. Welcome to Introduction to Quantum Computing. I am your guide, Associate Professor Chris Ferrie, a...
Read more >
How to Implement a noisy identity gate on qiskit?
I can successfully implement the U gate (single qubit) on qiskit, but when I am trying for the identity operation it is not...
Read more >
Operations glossary - IBM Quantum
Quantum operations include quantum gates, such as the Hadamard gate, ... The identity gate (sometimes called the Id or the I gate) is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found