Main Content

Types of Quantum Gates

Note

Installation Required: This functionality requires MATLAB Support Package for Quantum Computing.

This topic provides a list of functions that you can use to create quantum gates in MATLAB®. Quantum gates are the building blocks of quantum circuits, and they enable you to program algorithms for a quantum computer. Quantum gates are reversible and have unitary matrix representations.

Creation Functions for SimpleGate Objects

Gates on One Target Qubit

Creation FunctionGate NameNo. of QubitsMatrix RepresentationProperties
Symbol of Hadamard gatehGate Hadamard gate112[1111]
  • Traceless

  • Involutory

Symbol of identity gateidGateIdentity gate1[1001]
  • Identity

  • Involutory

Symbol of Pauli X gatexGatePauli X gate1[0110]
  • Traceless

  • Involutory

  • Pauli group

Symbol of Pauli Y gateyGatePauli Y gate1[0ii0]
  • Traceless

  • Involutory

  • Pauli group

Symbol of Pauli Z gatezGatePauli Z gate1[1001]
  • Traceless

  • Involutory

  • Pauli group

Rotation Gates

Creation FunctionGate NameNo. of QubitsMatrix RepresentationProperties
Symbol of x-axis rotation gaterxGatex-axis rotation gate1[cos(θ2)isin(θ2)isin(θ2)cos(θ2)]
  • Special unitary (determinant is 1)

  • Continuous parameter θ with period 4π

Symbol of y-axis rotation gateryGatey-axis rotation gate1[cos(θ2)sin(θ2)sin(θ2)cos(θ2)]
  • Special unitary (determinant is 1)

  • Continuous parameter θ with period 4π

Symbol of z-axis rotation gaterzGatez-axis rotation gate1[exp(iθ2)00exp(iθ2)]
  • Special unitary (determinant is 1)

  • Continuous parameter θ with period 4π

Symbol of R1 gater1Gatez-axis rotation gate with global phase1[100exp(iθ)]
  • Continuous parameter θ with period 2π

Symbol of S gatesGateS gate1[100i] 
Symbol of inverse S gatesiGateInverse S gate1[100i] 
Symbol of T gatetGateT gate1[1001+i2] 
Symbol of inverse T gatetiGateInverse T gate1[1001i2] 

Gates with One Control Qubit and One Target Qubit

Creation FunctionGate NameNo. of QubitsMatrix RepresentationProperties
Symbol of controlled Hadamard gatechGate Controlled Hadamard gate2[10000100001212001212]
  • Involutory

Symbol of controlled X gatecxGate or cnotGate

Controlled X or CNOT gate2[1000010000010010]
  • Involutory

Symbol of controlled Y gatecyGateControlled Y gate2[10000100000i00i0]
  • Involutory

Symbol of controlled Z gateczGateControlled Z gate2[1000010000100001]
  • Involutory

  • Swapping control and target qubits does not change gate operation

Gate That Swap States of Two Qubits

Creation FunctionGate NameNo. of QubitsMatrix RepresentationProperties
Symbol of swap gateswapGateSwap gate2[1000001001000001]
  • Involutory

  • Swapping the two target qubits does not change gate operation

Controlled Rotation Gates

Creation FunctionGate NameNo. of QubitsMatrix RepresentationProperties
Symbol of controlled x-axis rotation gatecrxGateControlled x-axis rotation gate2[1000010000cos(θ2)isin(θ2)00isin(θ2)cos(θ2)]
  • Continuous parameter θ with period 4π

Symbol of controlled y-axis rotation gatecryGateControlled y-axis rotation gate2[1000010000cos(θ2)sin(θ2)00sin(θ2)cos(θ2)]
  • Continuous parameter θ with period 4π

Symbol of controlled z-axis rotation gatecrzGateControlled z-axis rotation gate2[1000010000exp(iθ2)0000exp(iθ2)]
  • Continuous parameter θ with period 4π

Symbol of controlled R1 gatecr1GateControlled z-axis rotation gate with global phase2[100001000010000exp(iθ)]
  • Continuous parameter θ with period 2π

  • Swapping control and target qubits does not change gate operation

Controlled Controlled X Gate

Creation FunctionGate NameNo. of QubitsMatrix RepresentationProperties
Symbol of CCNOT gateccxGateControlled controlled X gate (CCNOT or Toffoli gate)3[1000000001000000001000000001000000001000000001000000000100000010]
  • Involutory

  • Swapping the two control qubits does not change gate operation

Ising Coupling Gates

Creation FunctionGate NameNo. of QubitsMatrix RepresentationProperties
Symbol of RXX gaterxxGateIsing XX coupling gate2[cos(θ2)00isin(θ2)0cos(θ2)isin(θ2)00isin(θ2)cos(θ2)0isin(θ2)00cos(θ2)]
  • Special unitary (determinant is 1)

  • Continuous parameter θ with period 4π

  • Swapping the two target qubits does not change gate operation

Symbol of RYY gateryyGateIsing YY coupling gate2[cos(θ2)00isin(θ2)0cos(θ2)isin(θ2)00isin(θ2)cos(θ2)0isin(θ2)00cos(θ2)]
  • Special unitary (determinant is 1)

  • Continuous parameter θ with period 4π

  • Swapping the two target qubits does not change gate operation

Symbol of RZZ gaterzzGateIsing ZZ coupling gate2[exp(iθ2)0000exp(iθ2)0000exp(iθ2)0000exp(iθ2)]
  • Special unitary (determinant is 1)

  • Continuous parameter θ with period 4π

  • Swapping the two target qubits does not change gate operation

Creation Functions for CompositeGate Objects

Composite and Specialized Gates

Creation FunctionGate NameNo. of QubitsGate SymbolEquivalent Internal GatesMatrix Representation
compositeGateComposite gateVaries

Example: Quantum circuit with two composite gates named "bell". The equivalent internal gates of each composite gate are a Hadamard gate and a controlled X gate.

Symbol of two composite gates named bellEquivalent internal gates for the two composite gates named bell

12[1010101001010101010101011010101010101010010101010101010110101010]

qftGateQuantum Fourier transform (QFT) gateVaries

Example: Quantum Fourier transform gate on three qubits. The equivalent internal gates are Hadamard gates, R1 gates, and a swap gate.

Symbol of QFT gate applied to three qubitsEquivalent internal gates for the QFT gate applied to three qubits

18[111111111ωω2ω3ω4ω5ω6ω71ω2ω4ω61ω2ω4ω61ω3ω6ωω4ω7ω2ω51ω41ω41ω41ω41ω5ω2ω7ω4ωω6ω31ω6ω4ω21ω6ω4ω21ω7ω6ω5ω4ω3ω2ω]whereω=exp(2πi8)

initGateInitialization gateVaries

Example: Initialization gate on three target qubits. The equivalent internal gates are inverse uniform controlled y-axis rotation gates.

Symbol of initialization gate with three target qubitsEquivalent internal gates for the initialization gate applied to three target qubitsinitGate applies a matrix U such that |ψ=U*|0, where |ψ is the vector representation of the input state.
unitaryGateUnitary matrix gateVaries

Example: Unitary matrix gate on three target qubits. The equivalent internal gates are four unitary matrix gates alternating between two uniform controlled z-axis rotation gates and one uniform controlled y-axis rotation gate.

Symbol of unitary matrix gate with three target qubitsEquivalent internal gates for the unitary matrix gate with three target qubitsunitaryGate applies the unitary matrix to the target qubits (up to global phase).
mcxGateMulti-controlled X gateVaries

Example: Multi-controlled X gate with three control qubits, one target qubit, and no ancilla qubit. The equivalent internal gates are Hadamard gates, controlled R1 gates, and controlled X gates.

Symbol of multi-controlled X gate with three control qubits, one target qubit, and no ancilla qubitEquivalent internal gates for the multi-controlled X gate with three control qubits, one target qubit, and no ancilla qubi

[100000001000000000000001000000010000000010000010]

Uniformly Controlled Rotation Gates

Creation FunctionGate NameNo. of QubitsGate SymbolEquivalent Internal GatesMatrix Representation
ucrxGateUniformly controlled x-axis rotation gateVaries

Example: Uniformly controlled x-axis rotation gate with one control qubit and one target qubit using rotation angle vector [θ1θ2]. The equivalent internal gates are x-axis rotation gates and controlled Z gates.

Symbol of uniformly controlled x-axis rotation gate with one control qubit and one target qubitEquivalent internal gates for the uniformly controlled x-axis rotation gate with one control qubit and one target qubit

[cos(θ12)isin(θ12)00isin(θ12)cos(θ12)0000cos(θ22)isin(θ22)00isin(θ22)cos(θ22)]

ucryGateUniformly controlled y-axis rotation gateVaries

Example: Uniformly controlled y-axis rotation gate with one control qubit and one target qubit using rotation angle vector [θ1θ2]. The equivalent internal gates are y-axis rotation gates and controlled X gates.

Symbol of uniformly controlled y-axis rotation gate with one control qubit and one target qubitEquivalent internal gates for the uniformly controlled y-axis rotation gate with one control qubit and one target qubit

[cos(θ12)sin(θ12)00sin(θ12)cos(θ12)0000cos(θ22)sin(θ22)00sin(θ22)cos(θ22)]

ucrzGateUniformly controlled z-axis rotation gateVaries

Example: Uniformly controlled z-axis rotation gate with one control qubit and one target qubit using rotation angle vector [θ1θ2]. The equivalent internal gates are z-axis rotation gates and controlled X gates.

Symbol of uniformly controlled z-axis rotation gate with one control qubit and one target qubitEquivalent internal gates for the uniformly controlled z-axis rotation gate with one control qubit and one target qubit

[exp(iθ12)0000exp(iθ12)0000exp(iθ22)0000exp(iθ22)]

See Also

|

Related Topics