Skip to content

Commit

Permalink
suggestions from code review + improved support for annotated.control
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderivrii committed Jan 31, 2024
1 parent d827990 commit 268b265
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions qiskit/circuit/annotated_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ def control(
num_ctrl_qubits: int = 1,
label: str | None = None,
ctrl_state: int | str | None = None,
annotated: bool = False,
):
annotated: bool = True,
) -> AnnotatedOperation:
"""
Return the controlled version of itself.
Expand All @@ -175,9 +175,11 @@ def control(
Controlled version of the given operation.
"""
# pylint: disable=unused-argument
return AnnotatedOperation(
self, ControlModifier(num_ctrl_qubits=num_ctrl_qubits, ctrl_state=ctrl_state)
extended_modifiers = self.modifiers.copy()
extended_modifiers.append(
ControlModifier(num_ctrl_qubits=num_ctrl_qubits, ctrl_state=ctrl_state)
)
return AnnotatedOperation(self.base_op, extended_modifiers)


def _canonicalize_modifiers(modifiers):
Expand Down

0 comments on commit 268b265

Please sign in to comment.