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, andtargetQubitare vectors of the same length,ccxGatereturns a column vector of gates, whereg(i)represents a controlled controlled X gate applied to theith element triplet ofcontrolQubit1,controlQubit2, andtargetQubit.If any of
controlQubit1,controlQubit2, ortargetQubitis 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, andtargetQubitmust not be the same.
Examples
Input Arguments
More About
Version History
Introduced in R2023a