Source code for pennylane_qsharp.ops

# Copyright 2019 Xanadu Quantum Technologies Inc.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

#     http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Custom operations
=================

**Module name:** :mod:`pennylane_qsharp.ops`

.. currentmodule:: pennylane_qsharp.ops

Contains some additional PennyLane qubit operations.

Operations
----------

.. autosummary::
    S
    T
    CCNOT

Code details
~~~~~~~~~~~~
"""
from pennylane.operation import Operation


[docs]class S(Operation): r"""S(wires) S gate. .. math:: S = \begin{bmatrix} 1 & 0 \\ 0 & i \end{bmatrix} **Details:** * Number of wires: 1 * Number of parameters: 0 Args: wires (int): the subsystem the gate acts on """ num_params = 0 num_wires = 1 par_domain = None
[docs]class T(Operation): r"""T(wires) T gate. .. math:: T = \begin{bmatrix}1&0\\0&e^{i \pi / 4}\end{bmatrix} **Details:** * Number of wires: 1 * Number of parameters: 0 Args: wires (int): the subsystem the gate acts on """ num_params = 0 num_wires = 1 par_domain = None
[docs]class CCNOT(Operation): r"""CCNOT(wires) Controlled-controlled-not gate. .. math:: CCNOT = \begin{bmatrix} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \end{bmatrix} **Details:** * Number of wires: 3 * Number of parameters: 0 Args: wires (int): the subsystem the gate acts on """ num_params = 0 num_wires = 3 par_domain = None