# Source code for pennylane_ionq.ops

# Copyright 2019 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
"""
Custom operations
"""
from pennylane.operation import Operation

[docs]class XX(Operation):
r"""XX(phi, wires)
The Ising XX gate.

.. math:: XX(\phi) = e^{-\frac{\phi}{2}\hat{X}\otimes\hat{X}}.

**Details:**

* Number of wires: 2
* Number of parameters: 1
* Gradient recipe: :math:\frac{d}{d\phi}f(XX(\phi)) = \frac{1}{2}\left[f(XX(\phi+\pi/2)) - f(XX(\phi-\pi/2))\right]
where :math:f is an expectation value depending on :math:XX(\phi).

Args:
phi (float): rotation angle :math:\phi
wires (Sequence[int]): the subsystems the operation acts on
"""
num_params = 1
num_wires = 2
par_domain = "R"

[docs]class YY(Operation):
r"""YY(phi, wires)
The Ising YY gate.

.. math:: YY(\phi) = e^{-\frac{\phi}{2}\hat{Y}\otimes\hat{Y}}.

**Details:**

* Number of wires: 2
* Number of parameters: 1
* Gradient recipe: :math:\frac{d}{d\phi}f(YY(\phi)) = \frac{1}{2}\left[f(YY(\phi+\pi/2)) - f(YY(\phi-\pi/2))\right]
where :math:f is an expectation value depending on :math:YY(\phi).

Args:
phi (float): rotation angle :math:\phi
wires (Sequence[int]): the subsystems the operation acts on
"""
num_params = 1
num_wires = 2
par_domain = "R"

[docs]class ZZ(Operation):
r"""ZZ(phi, wires)
The Ising ZZ gate.

.. math:: ZZ(\phi) = e^{-\frac{\phi}{2}\hat{Z}\otimes\hat{Z}}.

**Details:**

* Number of wires: 2
* Number of parameters: 1
* Gradient recipe: :math:\frac{d}{d\phi}f(ZZ(\phi)) = \frac{1}{2}\left[f(ZZ(\phi+\pi/2)) - f(ZZ(\phi-\pi/2))\right]
where :math:f is an expectation value depending on :math:ZZ(\phi).

Args:
phi (float): rotation angle :math:\phi
wires (Sequence[int]): the subsystems the operation acts on
"""
num_params = 1
num_wires = 2
par_domain = "R"