rxxGate

Ising XX coupling gate

Since R2023a

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

Syntax

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

Description

````g = rxxGate(targetQubit1,targetQubit2,theta)` applies an Ising XX 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, `rxxGate` returns a column vector of gates, where `g(i)` represents an Ising XX 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.```

example

Examples

collapse all

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

`g = rxxGate(1,2,pi/2)`
```g = SimpleGate with properties: Type: "rxx" 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 XX 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 = rxxGate(1:3,2:4,pi/4*(1:3))`
```g = 3×1 SimpleGate array with gates: Id Gate Control Target Angle 1 rxx [1,2] pi/4 2 rxx [2,3] pi/2 3 rxx [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 XX Coupling Gate

The matrix representation of an Ising XX 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}X\otimes X\right)=\mathrm{exp}\left(-i\text{\hspace{0.17em}}\frac{\theta }{2}\left[\begin{array}{cc}0& 1\\ 1& 0\end{array}\right]\otimes \left[\begin{array}{cc}0& 1\\ 1& 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