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.

Why does `ControlledGate` have a notion of qubits

See original GitHub issue

ControlledGate.control_qubits is a tuple of Qid (or Nones). I thought “gates” don’t have qubits and that that is reserved for Operations.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
mpharrigancommented, Aug 20, 2019

If you can have partially specified qubits, I’m led to ask why bother having a difference between Gate and Operation at all? There could be one object that has any of its qubits specified or not. If all of them are there, it would be similar to an Operation. If none of them are there, it would be similar to (most) Gates.

Earlier versions of pyquil provided first-class support for partial specification of qubits for each gate/operation. I ripped that out since people typically didn’t use it (especially for NISQ algorithms) and in special cases you could use closures (at the python language level) for the same effect.

0reactions
smitsanghavicommented, Sep 6, 2019

The original reason for going this route was to have the flexibility of calling control(GateX, my_control_qubits) to generate a ControlledGate where you can specify the qubits GateX uses (and also some more controls) later. The assumption was that control qubits might be used differently than “regular” qubits and having an option to pre-specify some controls without being asked to resolve the underlying Gate to an Operation might come in handy.

But if in the subsequent months no such use case has shown up, cleaning up the additional complexity is probably a good idea.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Controlled NOT gate
Any quantum circuit can be simulated to an arbitrary degree of accuracy using a combination of CNOT gates and single qubit rotations. The...
Read more >
ControlledGate
If the gate has open controls, as determined from self.ctrl_state , the returned definition is conjugated with X without changing the internal _definition...
Read more >
Adding A Control To A Quantum-Gate | by Frank Zickert
When we entangle two qubits, we can refine the behavior of the X-gate. ... qubit is |0⟩ because in this case, the CNOT-gate...
Read more >
Controlled Gate - an overview
1.4 Quantum Gates and QIP. In quantum mechanics, the primitive undefined concepts are physical system, observable, and state. The concept of state has...
Read more >
Why is the action of controlled-Z unaltered by exchanging ...
If we have an arbitrary two qubit state: |ψ⟩=a|00⟩+b|01⟩+c|10⟩+d|11⟩. then after applying CZ1→2 controlled from the first qubit we ...
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