Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
purva-thakre committed Jul 16, 2021
1 parent d23d079 commit 58a99b4
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 22 deletions.
21 changes: 21 additions & 0 deletions doc/source/_apidoc/qutip_qip.decompose.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
qutip\_qip.decompose package
============================

Submodules
----------

qutip\_qip.decompose.decompose\_single\_qubit\_gate module
----------------------------------------------------------

.. automodule:: qutip_qip.decompose.decompose_single_qubit_gate
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: qutip_qip.decompose
:members:
:undoc-members:
:show-inheritance:
9 changes: 1 addition & 8 deletions doc/source/_apidoc/qutip_qip.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Subpackages

qutip_qip.algorithms
qutip_qip.compiler
qutip_qip.decompose
qutip_qip.device
qutip_qip.operations
qutip_qip.transpiler
Expand All @@ -32,14 +33,6 @@ qutip\_qip.circuit\_latex module
:undoc-members:
:show-inheritance:

qutip\_qip.decompose module
---------------------------

.. automodule:: qutip_qip.decompose
:members:
:undoc-members:
:show-inheritance:

qutip\_qip.gates module
-----------------------

Expand Down
12 changes: 6 additions & 6 deletions src/qutip_qip/decompose/decompose_single_qubit_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def _angles_for_ZYZ(input_gate):
return (alpha, -theta, beta, global_phase_angle)


def ZYZ_rotation(input_gate):
def _ZYZ_rotation(input_gate):
r"""An input 1-qubit gate is expressed as a product of rotation matrices
:math:`\textrm{R}_z` and :math:`\textrm{R}_y`.
Expand Down Expand Up @@ -77,7 +77,7 @@ def ZYZ_rotation(input_gate):
return (Rz_alpha, Ry_theta, Rz_beta, Phase_gate)


def ZXZ_rotation(input_gate):
def _ZXZ_rotation(input_gate):
r"""An input 1-qubit gate is expressed as a product of rotation matrices
:math:`\textrm{R}_z` and :math:`\textrm{R}_x`.
Expand Down Expand Up @@ -123,7 +123,7 @@ def ZXZ_rotation(input_gate):
# Functions for ABC_decomposition


def ZYZ_pauli_X(input_gate):
def _ZYZ_pauli_X(input_gate):
"""Returns a 1 qubit unitary as a product of ZYZ rotation matrices and
Pauli X."""
check_gate(input_gate, num_qubits=1)
Expand Down Expand Up @@ -171,9 +171,9 @@ def ZYZ_pauli_X(input_gate):


_single_decompositions_dictionary = {
"ZYZ": ZYZ_rotation,
"ZXZ": ZXZ_rotation,
"ZYZ_PauliX": ZYZ_pauli_X,
"ZYZ": _ZYZ_rotation,
"ZXZ": _ZXZ_rotation,
"ZYZ_PauliX": _ZYZ_pauli_X,
} # other combinations to add here


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
Qobj, average_gate_fidelity, rand_unitary, sigmax, sigmay, sigmaz
)
from qutip_qip.decompose.decompose_single_qubit_gate import (
ZYZ_rotation,
ZXZ_rotation,
ZYZ_pauli_X,
_ZYZ_rotation,
_ZXZ_rotation,
_ZYZ_pauli_X,
)
from qutip_qip.decompose import decompose_one_qubit_gate
from qutip_qip.circuit import decomposed_gates_to_circuit, compute_unitary
Expand All @@ -31,7 +31,7 @@
"gate", [H, sigmax, sigmay, sigmaz, SQRTNOT, S, T, rand_unitary(2)]
)
@pytest.mark.parametrize(
"method", [ZYZ_rotation, ZXZ_rotation, ZYZ_pauli_X]
"method", [_ZYZ_rotation, _ZXZ_rotation, _ZYZ_pauli_X]
)
def test_single_qubit_to_rotations(gate, method):
"""Initial matrix and product of final decompositions are same within some
Expand Down Expand Up @@ -68,7 +68,7 @@ def test_check_single_qubit_to_decompose_to_rotations(gate, method):
"gate", [H, sigmax, sigmay, sigmaz, SQRTNOT, S, T, rand_unitary(2)]
)
@pytest.mark.parametrize(
"method", [ZYZ_rotation, ZXZ_rotation, ZYZ_pauli_X]
"method", [_ZYZ_rotation, _ZXZ_rotation, _ZYZ_pauli_X]
)
def test_output_is_tuple(gate, method):
"""Initial matrix and product of final decompositions are same within some
Expand Down
6 changes: 3 additions & 3 deletions tests/test_circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
_para_gates
)

from qutip_qip.decompose.decompose_single_qubit_gate import ZYZ_rotation
from qutip_qip.decompose.decompose_single_qubit_gate import _ZYZ_rotation

import qutip as qp

Expand Down Expand Up @@ -691,8 +691,8 @@ def test_decomposed_gates_to_circuit(invalid_input):

H = Qobj([[1/np.sqrt(2), 1/np.sqrt(2)], [1/np.sqrt(2), -1/np.sqrt(2)]])
sigmax = Qobj([[0, 1], [1, 0]])
H_zyz_gates = ZYZ_rotation(H)
sigmax_zyz_gates = ZYZ_rotation(sigmax)
H_zyz_gates = _ZYZ_rotation(H)
sigmax_zyz_gates = _ZYZ_rotation(sigmax)


@pytest.mark.parametrize("valid_input", [H_zyz_gates, sigmax_zyz_gates])
Expand Down

0 comments on commit 58a99b4

Please sign in to comment.