ccxGate
Installation Required: This functionality requires MATLAB Support Package for Quantum Computing.
Description
applies a controlled controlled X gate to a target qubit based on the state of two control
qubits and returns a g
= ccxGate(controlQubit1
,controlQubit2
,targetQubit
)quantum.gate.SimpleGate
object. If one or both control qubits are in the state, then this gate does nothing. If both control qubits are in the state, then this gate applies the Pauli X gate (xGate
)
to the target qubit. This gate is also known as the CCNOT gate or Toffoli gate.
If
controlQubit1
,controlQubit2
, andtargetQubit
are vectors of the same length,ccxGate
returns a column vector of gates, whereg(i)
represents a controlled controlled X gate applied to thei
th element triplet ofcontrolQubit1
,controlQubit2
, andtargetQubit
.If any of
controlQubit1
,controlQubit2
, ortargetQubit
is a scalar, and at least one of the inputs is a vector, then MATLAB® expands the scalar to match the size of the vector input.The qubit indices in each element triplet of
controlQubit1
,controlQubit2
, andtargetQubit
must not be the same.
Examples
Input Arguments
More About
Version History
Introduced in R2023a