Contenu principal

ryyGate

Ising YY coupling gate

Since R2023a

Description

Add-On Required: This feature requires the MATLAB Support Package for Quantum Computing add-on.

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

  • If targetQubit1, targetQubit2, and theta are vectors of the same length, ryyGate returns a column vector of gates, where g(i) represents an Ising YY 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 YY coupling gate that acts on two target qubits with indices 1 and 2 using a phase angle of pi/2.

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

  SimpleGate with properties:

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

Get the matrix representation of the gate.

M = getMatrix(g)
M =

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

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

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

  3×1 SimpleGate array with gates:

    Id   Gate   Control   Target   Angle
     1   ryy              [1,2]    pi/4 
     2   ryy              [2,3]    pi/2 
     3   ryy              [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 angle, specified as a real scalar, real vector, string scalar, string vector, symbolic scalar, or symbolic vector. Specify the phase angle as a vector to create an array of gates where each element of the vector corresponds to the phase angle of one gate.

Use strings or symbolic values to specify variables for parameterized phase angles. You can specify values for parameters when calling the simulate, getMatrix, and observe functions on a quantum circuit that contains parameterized gates. (since R2026a)

Example: pi

Example: (1:3)*pi/2

Example: ["x" "y" "z"]

More About

collapse all

Version History

Introduced in R2023a

expand all