qiskit icon indicating copy to clipboard operation
qiskit copied to clipboard

Deprecate CU1Gate

Open kevinsung opened this issue 1 year ago • 2 comments

U1Gate is deprecated, so it seems sensible that CU1Gate should also be deprecated. I'm looking at the docs, where U1Gate has a deprecation warning but CU1Gate does not:

  • https://docs.quantum.ibm.com/api/qiskit/qiskit.circuit.library.U1Gate
  • https://docs.quantum.ibm.com/api/qiskit/qiskit.circuit.library.CU1Gate

kevinsung avatar Aug 19 '24 22:08 kevinsung

This seems sensible - CPhaseGate is a direct replacement. Fwiw, we didn't deprecate U1Gate and friends formally in code, they're just deprecated by the documentation notice. The reason is roughly that there's still a lot of extant circuits / OQ2 code / etc out there that uses them, and keeping the gate class around so they can still be represented doesn't really hurt us.

We did deprecate (and remove) the circuit methods u1, u2 and u3, though, and I think deprecating and removing QuantumCircuit.cu1 would be equally appropriate.

There is the awkward question about CU3Gate, though; we don't have a direct replacement for that (CUGate exists, but it's a lot more awkward to use because it breaks the typical controlled-gate flow by adding in a control-phase parameter).

jakelishman avatar Aug 21 '24 11:08 jakelishman

There is the awkward question about CU3Gate, though; we don't have a direct replacement for that (CUGate exists, but it's a lot more awkward to use because it breaks the typical controlled-gate flow by adding in a control-phase parameter).

True, though we're replacing calling CU3Gate directly, which could be (almost) directly replaced with CUGate, no?

Cryoris avatar Aug 22 '24 07:08 Cryoris

Hi @kevinsung @jakelishman I can work on this

melechlapson avatar Sep 04 '24 18:09 melechlapson

Sounds good @melechlapson, let us know if you want to discuss something -- otherwise @jakelishman's comment above points out some places to start 🙂

Cryoris avatar Sep 05 '24 12:09 Cryoris

@Cryoris Should I add a deprecation warning to MCU1 as well?

melechlapson avatar Sep 05 '24 21:09 melechlapson

Yes, as MCPhaseGate is a direct replacement we can also deprecate MCU1Gate 👍🏻

Cryoris avatar Sep 06 '24 07:09 Cryoris

We did deprecate (and remove) the circuit methods u1, u2 and u3, though, and I think deprecating and removing QuantumCircuit.cu1 would be equally appropriate.

@jakelishman Isn't QuantumCircuit.cu1 already removed and deprecated? It's just the CU1Gate that remains

melechlapson avatar Sep 06 '24 16:09 melechlapson

@Cryoris I opened https://github.com/Qiskit/qiskit/pull/13115 to address this. Could you review when you have time?

melechlapson avatar Sep 10 '24 15:09 melechlapson

make sure you link it to this pull request @melechlapson or else it likely can't be found.

cameron-d28 avatar Sep 28 '24 14:09 cameron-d28

@Cryoris #13115 was merged, however this issue is still open, is this issue yet to be resolved?

alphashiv27 avatar Oct 13 '24 16:10 alphashiv27

@alphashiv27 it seems we just forgot to link the PR to this issue -- thanks for the reminder!

Cryoris avatar Oct 14 '24 07:10 Cryoris