Main Content

rzzGate

Ising ZZ coupling gate

Since R2023a

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

Description

g = rzzGate(targetQubit1,targetQubit2,theta) applies an Ising ZZ coupling gate to two target qubits with a phase parameter theta and returns a quantum.gate.SimpleGate object.

  • If targetQubit1, targetQubit2, and theta are vectors of the same length, rzzGate returns a column vector of gates, where g(i) represents an Ising ZZ coupling gate applied to the ith element triplet of targetQubit1, targetQubit2, and theta.

  • If any of targetQubit1, targetQubit2, or theta 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 pair of targetQubit1 and targetQubit2 must not be the same.

example

Examples

collapse all

Create an Ising ZZ coupling gate that acts on two target qubits with indices 1 and 2 using a phase parameter of pi/2.

g = rzzGate(1,2,pi/2)
g = 

  SimpleGate with properties:

             Type: "rzz"
    ControlQubits: [1×0 double]
     TargetQubits: [1 2]
           Angles: 1.5708

Get the matrix representation of the gate.

M = getMatrix(g)
M =

   0.7071 - 0.7071i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i
   0.0000 + 0.0000i   0.7071 + 0.7071i   0.0000 + 0.0000i   0.0000 + 0.0000i
   0.0000 + 0.0000i   0.0000 + 0.0000i   0.7071 + 0.7071i   0.0000 + 0.0000i
   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.7071 - 0.7071i

Create an array of three Ising ZZ coupling gates. The first gate acts on target qubits 1 and 2 with phase parameter pi/4, the next gate acts on target qubits 2 and 3 with phase parameter pi/2, and the final gate acts on target qubits 3 and 4 with phase parameter 3*pi/4.

g = rzzGate(1:3,2:4,pi/4*(1:3))
g = 

  3×1 SimpleGate array with gates:

    Id   Gate   Control   Target   Angle
     1   rzz              [1,2]    pi/4 
     2   rzz              [2,3]    pi/2 
     3   rzz              [3,4]    3pi/4

Input Arguments

collapse all

First target qubit of the gate, specified as a positive integer scalar index or vector of qubit indices.

Example: 1

Example: 3:5

Second target qubit of the gate, specified as a positive integer scalar index or vector of qubit indices.

Example: 2

Example: 6:8

Phase parameter, specified as a real scalar or vector.

Example: pi

Example: (1:3)*pi/2

More About

collapse all

Matrix Representation of Ising ZZ Coupling Gate

The matrix representation of an Ising ZZ coupling gate applied to two target qubits with a phase parameter of θ is

exp(iθ2ZZ)=exp(iθ2[1001][1001])=[exp(iθ2)0000exp(iθ2)0000exp(iθ2)0000exp(iθ2)]

Version History

Introduced in R2023a