# ryyGate

Ising YY coupling gate

Since R2023a

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

## Syntax

``g = ryyGate(targetQubit1,targetQubit2,theta)``

## Description

example

````g = ryyGate(targetQubit1,targetQubit2,theta)` applies an Ising YY 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, `ryyGate` returns a column vector of gates, where `g(i)` represents an Ising YY coupling gate applied to the `i`th 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.```

## Examples

collapse all

Create an Ising YY coupling gate that acts on two target qubits with indices 1 and 2 using a phase parameter 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 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 = 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 parameter, specified as a real scalar or vector.

Example: `pi`

Example: `(1:3)*pi/2`

collapse all

### Matrix Representation of Ising YY Coupling Gate

The matrix representation of an Ising YY coupling gate applied to two target qubits with a phase parameter of $\theta$ is

`$\mathrm{exp}\left(-i\text{\hspace{0.17em}}\frac{\theta }{2}Y\otimes Y\right)=\mathrm{exp}\left(-i\text{\hspace{0.17em}}\frac{\theta }{2}\left[\begin{array}{cc}0& -i\\ i& 0\end{array}\right]\otimes \left[\begin{array}{cc}0& -i\\ i& 0\end{array}\right]\right)=\left[\begin{array}{cccc}\mathrm{cos}\left(\frac{\theta }{2}\right)& 0& 0& i\text{\hspace{0.17em}}\mathrm{sin}\left(\frac{\theta }{2}\right)\\ 0& \mathrm{cos}\left(\frac{\theta }{2}\right)& -i\text{\hspace{0.17em}}\mathrm{sin}\left(\frac{\theta }{2}\right)& 0\\ 0& -i\text{\hspace{0.17em}}\mathrm{sin}\left(\frac{\theta }{2}\right)& \mathrm{cos}\left(\frac{\theta }{2}\right)& 0\\ i\text{\hspace{0.17em}}\mathrm{sin}\left(\frac{\theta }{2}\right)& 0& 0& \mathrm{cos}\left(\frac{\theta }{2}\right)\end{array}\right].$`

## Version History

Introduced in R2023a