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.

Consistent naming of controlled gates

See original GitHub issue

As discussed with @ewinston, the names of the controlled gates are inconsistent. For instance, the controlled version of HGate is called CHGate but YGate becomes CyGate. This applies to many others too. We should name them all consistently.

Possible choices would be:

  1. Only the first letter of the gate name is upper case, i.e.
YGate CyGate RyGate CryGate U3Gate Cu3Gate
  1. The gate names are full uppercase, i.e.
YGate CYGate RYGate CRYGate U3Gate CU3Gate
  1. The control gates only prepend a C, the gate name is kept, i.e.
YGate CYGate RyGate CRyGate U3Gate CU3Gate

Currently the rotations are called RXGate, thus 2. and 3. might be the same. Most rotation gates follow 1., which I personally think looks most aesthetic and fits also with the named gates as Fredkin or Toffoli. However, I think writing all in uppercase is probably the least error-prone method.

What are the thoughts on this?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
ajavadiacommented, Jan 7, 2020

I would also like to see a gate namespace that has aliases for the lower case circuit extensions to the gate objects. Eg something like gates.cx => CXGate. Here you could also add additional aliases if desired, eg gates.ccx, gates.toffoli => CCXGate

Yes please I have been wanting to move these gates out of qiskit.extensions for 2 years. Moving them to qiskit.circuit.gates sounds good, and exposing a qiskit.gates namespace so that one can do:

from qiskit import gates
circuit.append(gates.cx, [0, 1])

@Cryoris can you start with the gate name standardization/deprecations first and then we do this in steps? Seems everyone is good with uppercase. IGate and qc.i seem fine to me.

0reactions
Cryoriscommented, Feb 25, 2020

Achieved via #3695 🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

Quantum logic gate - Wikipedia
Common quantum logic gates by name (including abbreviation), circuit form(s) and the corresponding unitary matrices.
Read more >
Circuit Library - Qiskit
Circuit Library ( qiskit.circuit.library )¶. The circuit library is a collection of well-studied and valuable circuits, directives, and gates.
Read more >
Gates, States, and Circuits - Gavin E. Crooks
10.3 Decomposition of controlled-unitary gates . ... Phase shift gate [0] The name arrises because this gate shifts the phase of the |1⟩....
Read more >
Quantum Information and Computation Chapter 5
This gate flips the second bit if the first is 1, and does nothing if the first bit is 0 (hence the name...
Read more >
Constructing Large Controlled Nots - Algorithmic Assertions
For example, go try to find a website or paper describing how to make a reversible increment gate out of Toffoli gates when...
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