MCPcopy
hub / github.com/Qiskit/qiskit / cx

Method cx

qiskit/circuit/quantumcircuit.py:6228–6266  ·  view source on GitHub ↗

r"""Apply :class:`~qiskit.circuit.library.CXGate`. For the full matrix form of this gate, see the underlying gate documentation. Args: control_qubit: The qubit(s) used as the control. target_qubit: The qubit(s) targeted by the gate. label: The st

(
        self,
        control_qubit: QubitSpecifier,
        target_qubit: QubitSpecifier,
        label: str | None = None,
        ctrl_state: str | int | None = None,
    )

Source from the content-addressed store, hash-verified

6226 return self._append_standard_gate(StandardGate.X, [qubit], (), label=label)
6227
6228 def cx(
6229 self,
6230 control_qubit: QubitSpecifier,
6231 target_qubit: QubitSpecifier,
6232 label: str | None = None,
6233 ctrl_state: str | int | None = None,
6234 ) -> InstructionSet:
6235 r"""Apply :class:`~qiskit.circuit.library.CXGate`.
6236
6237 For the full matrix form of this gate, see the underlying gate documentation.
6238
6239 Args:
6240 control_qubit: The qubit(s) used as the control.
6241 target_qubit: The qubit(s) targeted by the gate.
6242 label: The string label of the gate in the circuit.
6243 ctrl_state:
6244 The control state in decimal, or as a bitstring (e.g. '1'). Defaults to controlling
6245 on the '1' state.
6246
6247 Returns:
6248 A handle to the instructions created.
6249 """
6250 # if the control state is |1> use the fast Rust version of the gate
6251 if ctrl_state is None or ctrl_state in ["1", 1]:
6252 return self._append_standard_gate(
6253 StandardGate.CX,
6254 [control_qubit, target_qubit],
6255 (),
6256 label=label,
6257 )
6258
6259 from .library.standard_gates.x import CXGate
6260
6261 return self.append(
6262 CXGate(label=label, ctrl_state=ctrl_state),
6263 [control_qubit, target_qubit],
6264 [],
6265 copy=False,
6266 )
6267
6268 def dcx(self, qubit1: QubitSpecifier, qubit2: QubitSpecifier) -> InstructionSet:
6269 r"""Apply :class:`~qiskit.circuit.library.DCXGate`.

Callers 15

synth_mcmt_xgateFunction · 0.95
_synth_mcx_special_casesFunction · 0.95
synth_cnot_phase_aamFunction · 0.95
synth_weighted_sum_carryFunction · 0.95
adder_ripple_c04Function · 0.95
adder_ripple_v95Function · 0.95
adder_ripple_r25Function · 0.95
adder_modular_v17Function · 0.95
_get_ucrzFunction · 0.95

Calls 3

_append_standard_gateMethod · 0.95
appendMethod · 0.95
CXGateClass · 0.85