swapGate
Installation Required: This functionality requires MATLAB Support Package for Quantum Computing.
Description
applies a swap gate that swaps the states of two target qubits and returns a g = swapGate(targetQubit1,targetQubit2)quantum.gate.SimpleGate object.
If
targetQubit1andtargetQubit2are vectors of the same length, thenswapGatereturns a column vector of gates, whereg(i)represents a swap gate applied to two target qubits with indicestargetQubit1(i)andtargetQubit2(i).If either
targetQubit1ortargetQubit2is a scalar, and the other input is a vector, then MATLAB® expands the scalar to match the size of the vector input.The qubit indices in each element pair of
targetQubit1andtargetQubit2must not be the same.
Examples
Input Arguments
More About
Version History
Introduced in R2023a