Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
IsmaelCesar committed Apr 2, 2024
1 parent e156f50 commit 8ae60a8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions qiskit/circuit/library/standard_gates/x.py
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,20 @@ def __init__(
relative_phase: bool = False,
action_only: bool = False,
):
"""
Args:
dirty_ancillas: when set to ``True``, the method applies an optimized multicontrolled-X gate
up to a relative phase using dirty ancillary qubits with the properties of lemmas 7 and 8
from arXiv:1501.06911, with at most 8*k - 6 CNOT gates.
For k within the range {1, ..., ceil(n/2)}. And for n representing the total number of qubits.
relative_phase: when set to ``True``, the method applies the optimized multicontrolled-X gate up to a
relative phase, in a way that, by lemma 7 of arXiv:1501.06911, the relative
phases of the ``action part`` cancel out with the phases of the ``reset part``.
action_only: when set to ``True``, the method applies only the action part of lemma 8 from arXiv:1501.06911.
"""
super().__init__(
num_ctrl_qubits,
label=label,
Expand Down Expand Up @@ -1508,6 +1522,8 @@ def _define(self):

qc.ccx(controls[0], controls[1], targets[i])
else:
# implements an optimized toffoli operation
# up to a diagonal gate, akin to lemma 6 of arXiv:1501.06911
qc.h(targets[i])
qc.t(targets[i])
qc.cx(q_controls[self.num_ctrl_qubits - i - 2], targets[i])
Expand Down

0 comments on commit 8ae60a8

Please sign in to comment.