Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
2 changes: 1 addition & 1 deletion qiskit/circuit/gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def control(
"""
if not annotated: # captures both None and False
# pylint: disable=cyclic-import
from .add_control import add_control
from ._add_control import add_control

return add_control(self, num_ctrl_qubits, label, ctrl_state)

Expand Down
6 changes: 6 additions & 0 deletions releasenotes/notes/private-add_control-2367872c0f7136c4.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
upgrade_circuits:
- |
The internal function ``qiskit.circuit.add_control.add_control`` was removed and inlined, as it is not part of the
Comment thread
alexanderivrii marked this conversation as resolved.
Outdated
public API. User that had been wrongly using it as ``add_control(SomeGate(...), ...)`` should change their code to
Comment thread
alexanderivrii marked this conversation as resolved.
Outdated
``SomeGate(...).control(...)`` instead.
9 changes: 4 additions & 5 deletions test/python/circuit/test_controlled_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from qiskit.quantum_info.operators.predicates import matrix_equal, is_unitary_matrix
from qiskit.quantum_info.random import random_unitary
from qiskit.quantum_info.states import Statevector
import qiskit.circuit.add_control as ac
from qiskit.transpiler.passes import UnrollCustomDefinitions, BasisTranslator
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qiskit.converters.circuit_to_dag import circuit_to_dag
Expand Down Expand Up @@ -1584,10 +1583,10 @@ class TestSingleControlledRotationGates(QiskitTestCase):
gry = ry.RYGate(theta)
grz = rz.RZGate(theta)

ugu1 = ac._unroll_gate(gu1, ["p", "u", "cx"])
ugrx = ac._unroll_gate(grx, ["p", "u", "cx"])
ugry = ac._unroll_gate(gry, ["p", "u", "cx"])
ugrz = ac._unroll_gate(grz, ["p", "u", "cx"])
ugu1 = u1.U1Gate(theta).definition
ugrx = rx.RXGate(theta).definition
ugry = ry.RYGate(theta).definition
ugrz = rz.RZGate(theta).definition
ugrz.params = grz.params

cgu1 = ugu1.control(num_ctrl)
Expand Down