# Source code for pennylane_aqt.ops

# Copyright 2020 Xanadu Quantum Technologies Inc.

# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# Unless required by applicable law or agreed to in writing, software
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
"""
This module contains custom AQT operations, designed to be used in PennyLane
QNodes when using the PennyLane-AQT devices.
"""
from pennylane.operation import Operation

[docs]class R(Operation):
r"""R(wires)
Two-parameter rotation gate.

.. math:: R(t,p) = \begin{bmatrix}
\cos(t\tfrac{\pi}{2}) & -i e^{-ip\pi}\sin(t\tfrac{\pi}{2}) \\
-i e^{ip\pi}\sin(t\tfrac{\pi}{2}) & \cos(t\tfrac{\pi}{2})
\end{bmatrix}

For further details, see the AQT API docs <https://www.aqt.eu/aqt-gate-definitions/>_.

**Details:**

* Number of wires: 1
* Number of parameters: 1

Args:
wires (int): the subsystem the gate acts on
"""
num_params = 2
num_wires = 1
par_domain = "R"

[docs]class MS(Operation):
r"""MS(wires)
Mølmer-Sørenson gate.

.. math:: MS(t) = \begin{bmatrix}
\cos(t\tfrac{\pi}{2}) & 0 & 0 & -i\sin(t\tfrac{\pi}{2}) \\
0 & \cos(t\tfrac{\pi}{2}) & -i\sin(t\tfrac{\pi}{2}) & 0 \\
0 & -i\sin(t\tfrac{\pi}{2}) & \cos(t\tfrac{\pi}{2}) & 0 \\
-i\sin(t\tfrac{\pi}{2}) & 0 & 0 & \cos(t\tfrac{\pi}{2})
\end{bmatrix}

For further details, see the AQT API docs <https://www.aqt.eu/aqt-gate-definitions/>_.

**Details:**

* Number of wires: 2
* Number of parameters: 1

Args:
wires (int): the subsystem the gate acts on
"""
num_params = 1
num_wires = 2
par_domain = "R"