Skip to content

Commit

Permalink
Merge pull request #153 from BoxiLi/doc_update
Browse files Browse the repository at this point in the history
Update the doc requirements
  • Loading branch information
BoxiLi committed Jun 22, 2022
2 parents 076451a + b9e7c3b commit 73c4a9b
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 106 deletions.
22 changes: 11 additions & 11 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
numpy==1.21
scipy==1.7
qutip==4.6
cython==0.29
sphinx==4.5
sphinx_rtd_theme==0.5.1
readthedocs-sphinx-search==0.1.0rc3
numpydoc==1.1
matplotlib==3.3
docutils==0.16
sphinxcontrib-bibtex==2.4
numpy==1.22.4
scipy==1.7.3
qutip==4.7.0
cython==0.29.30
sphinx==5.0.2
sphinx_rtd_theme==1.0.0
readthedocs-sphinx-search==0.1.2
numpydoc==1.4.0
matplotlib==3.5.2
docutils==0.17.1
sphinxcontrib-bibtex==2.4.2
2 changes: 2 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ def qutip_qip_version():
import os
import warnings
warnings.filterwarnings("ignore")
import numpy as np
np.set_printoptions(precision=5)
os_nt = {}
'''.format(os_nt)

Expand Down
24 changes: 8 additions & 16 deletions doc/source/qip-basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,10 @@ gate function returning a :class:`qutip.Qobj` and save it in the attribute ``use

Quantum object: dims = [[2, 2], [2, 2]], shape = (4, 4), type = oper, isherm = False
Qobj data =
[[1. +0.j 0. +0.j 0. +0.j
0. +0.j ]
[0. +0.j 1. +0.j 0. +0.j
0. +0.j ]
[0. +0.j 0. +0.j 0.70710678+0.j
0. -0.70710678j]
[0. +0.j 0. +0.j 0. -0.70710678j
0.70710678+0.j ]]
[[1. +0.j 0. +0.j 0. +0.j 0. +0.j ]
[0. +0.j 1. +0.j 0. +0.j 0. +0.j ]
[0. +0.j 0. +0.j 0.70711+0.j 0. -0.70711j]
[0. +0.j 0. +0.j 0. -0.70711j 0.70711+0.j ]]

.. testcode::

Expand All @@ -250,14 +246,10 @@ gate function returning a :class:`qutip.Qobj` and save it in the attribute ``use

Quantum object: dims = [[2, 2], [2, 2]], shape = (4, 4), type = oper, isherm = False
Qobj data =
[[1. +0.j 0. +0.j 0. +0.j
0. +0.j ]
[0. +0.j 0.70710678+0.j 0. +0.j
0. -0.70710678j]
[0. +0.j 0. +0.j 1. +0.j
0. +0.j ]
[0. +0.j 0. -0.70710678j 0. +0.j
0.70710678+0.j ]]
[[1. +0.j 0. +0.j 0. +0.j 0. +0.j ]
[0. +0.j 0.70711+0.j 0. +0.j 0. -0.70711j]
[0. +0.j 0. +0.j 1. +0.j 0. +0.j ]
[0. +0.j 0. -0.70711j 0. +0.j 0.70711+0.j ]]


.. testcode::
Expand Down
80 changes: 32 additions & 48 deletions doc/source/qip-simulator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ method.

Quantum object: dims = [[2, 2, 2], [1, 1, 1]], shape = (8, 1), type = ket
Qobj data =
[[0. ]
[0.57734961]
[0.57734961]
[0. ]
[0.57735159]
[0. ]
[0. ]
[0. ]]
[[0. ]
[0.57735]
[0.57735]
[0. ]
[0.57735]
[0. ]
[0. ]
[0. ]]


As expected, the state returned is indeed the required W-state.
Expand Down Expand Up @@ -178,14 +178,14 @@ The :class:`.CircuitSimulator` class also enables stepping through the circuit:

Quantum object: dims = [[2, 2, 2], [1, 1, 1]], shape = (8, 1), type = ket
Qobj data =
[[0.57735159]
[0. ]
[0. ]
[0. ]
[0.81649565]
[0. ]
[0. ]
[0. ]]
[[0.57735]
[0. ]
[0. ]
[0. ]
[0.8165 ]
[0. ]
[0. ]
[0. ]]

This only executes one gate in the circuit and
allows for a better understanding of how the state evolution takes place.
Expand All @@ -210,22 +210,14 @@ precomputes the product of the unitaries (in between the measurements):

[Quantum object: dims = [[2, 2, 2], [2, 2, 2]], shape = (8, 8), type = oper, isherm = False
Qobj data =
[[ 0. 0.57734961 0. -0.57734961 0. 0.40824922
0. -0.40824922]
[ 0.57734961 0. -0.57734961 0. 0.40824922 0.
-0.40824922 0. ]
[ 0.57734961 0. 0.57734961 0. 0.40824922 0.
0.40824922 0. ]
[ 0. 0.57734961 0. 0.57734961 0. 0.40824922
0. 0.40824922]
[ 0.57735159 0. 0. 0. -0.81649565 0.
0. 0. ]
[ 0. 0.57735159 0. 0. 0. -0.81649565
0. 0. ]
[ 0. 0. 0.57735159 0. 0. 0.
-0.81649565 0. ]
[ 0. 0. 0. 0.57735159 0. 0.
0. -0.81649565]],
[[ 0. 0.57735 0. -0.57735 0. 0.40825 0. -0.40825]
[ 0.57735 0. -0.57735 0. 0.40825 0. -0.40825 0. ]
[ 0.57735 0. 0.57735 0. 0.40825 0. 0.40825 0. ]
[ 0. 0.57735 0. 0.57735 0. 0.40825 0. 0.40825]
[ 0.57735 0. 0. 0. -0.8165 0. 0. 0. ]
[ 0. 0.57735 0. 0. 0. -0.8165 0. 0. ]
[ 0. 0. 0.57735 0. 0. 0. -0.8165 0. ]
[ 0. 0. 0. 0.57735 0. 0. 0. -0.8165 ]],
Measurement(M0, target=[0], classical_store=0),
Measurement(M1, target=[1], classical_store=1),
Measurement(M2, target=[2], classical_store=2)]
Expand Down Expand Up @@ -274,22 +266,14 @@ just by measurement on the first qubit:

Quantum object: dims = [[2, 2, 2], [2, 2, 2]], shape = (8, 8), type = oper, isherm = True
Qobj data =
[[0. 0. 0. 0. 0. 0.
0. 0. ]
[0. 0.33333257 0. 0. 0. 0.
0. 0. ]
[0. 0. 0.33333257 0. 0. 0.
0. 0. ]
[0. 0. 0. 0. 0. 0.
0. 0. ]
[0. 0. 0. 0. 0.33333486 0.
0. 0. ]
[0. 0. 0. 0. 0. 0.
0. 0. ]
[0. 0. 0. 0. 0. 0.
0. 0. ]
[0. 0. 0. 0. 0. 0.
0. 0. ]]
[[0. 0. 0. 0. 0. 0. 0. 0. ]
[0. 0.33333 0. 0. 0. 0. 0. 0. ]
[0. 0. 0.33333 0. 0. 0. 0. 0. ]
[0. 0. 0. 0. 0. 0. 0. 0. ]
[0. 0. 0. 0. 0.33333 0. 0. 0. ]
[0. 0. 0. 0. 0. 0. 0. 0. ]
[0. 0. 0. 0. 0. 0. 0. 0. ]
[0. 0. 0. 0. 0. 0. 0. 0. ]]

We are left with a mixed state.

Expand Down
2 changes: 1 addition & 1 deletion src/qutip_qip/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2099,7 +2099,7 @@ def get_final_states(self, index=None):
Indicates i-th state to be returned.
Returns
----------
-------
final_states: Qobj or list of Qobj.
List of output kets or density matrices.
"""
Expand Down
8 changes: 4 additions & 4 deletions src/qutip_qip/compiler/cavityqedcompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ class CavityQEDCompiler(GateCompiler):
>>> compiler = CavityQEDCompiler(2, params=model.params)
>>> processor.load_circuit(
... qc, compiler=compiler) # doctest: +NORMALIZE_WHITESPACE
({'sz0': array([ 0. , 2500. , 2500.01315789]),
'sz1': array([ 0. , 2500. , 2500.01315789]),
'g0': array([ 0. , 2500. , 2500.01315789]),
'g1': array([ 0. , 2500. , 2500.01315789])},
({'sz0': array([ 0. , 2500. , 2500.01316]),
'sz1': array([ 0. , 2500. , 2500.01316]),
'g0': array([ 0. , 2500. , 2500.01316]),
'g1': array([ 0. , 2500. , 2500.01316])},
{'sz0': array([-0.5, -9.5]),
'sz1': array([-0.5, -9.5]),
'g0': array([0.01, 0. ]),
Expand Down
4 changes: 2 additions & 2 deletions src/qutip_qip/device/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ def get_control(self, label):
(Quantum object: dims = [[2], [2]], shape = (2, 2),
type = oper, isherm = True
Qobj data =
[[ 6.28318531 0. ]
[ 0. -6.28318531]], 0)
[[ 6.28319 0. ]
[ 0. -6.28319]], 0)
"""
return self.model.get_control(label)

Expand Down
44 changes: 22 additions & 22 deletions src/qutip_qip/operations/gateclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,8 @@ class RX(SingleQubitGate):
>>> RX(0, 3.14159/2).get_compact_qobj() # doctest: +NORMALIZE_WHITESPACE
Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = False
Qobj data =
[[0.70710725+0.j 0. -0.70710631j]
[0. -0.70710631j 0.70710725+0.j ]]
[[0.70711+0.j 0. -0.70711j]
[0. -0.70711j 0.70711+0.j ]]
"""

def __init__(self, targets, arg_value, **kwargs):
Expand All @@ -499,8 +499,8 @@ class RY(SingleQubitGate):
>>> RY(0, 3.14159/2).get_compact_qobj() # doctest: +NORMALIZE_WHITESPACE
Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = False
Qobj data =
[[ 0.70710725 -0.70710631]
[ 0.70710631 0.70710725]]
[[ 0.70711 -0.70711]
[ 0.70711 0.70711]]
"""

def __init__(self, targets, arg_value, **kwargs):
Expand All @@ -521,8 +521,8 @@ class RZ(SingleQubitGate):
>>> RZ(0, 3.14159/2).get_compact_qobj() # doctest: +NORMALIZE_WHITESPACE
Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = False
Qobj data =
[[0.70710725-0.70710631j 0. +0.j ]
[0. +0.j 0.70710725+0.70710631j]]
[[0.70711-0.70711j 0. +0.j ]
[0. +0.j 0.70711+0.70711j]]
"""

def __init__(self, targets, arg_value, **kwargs):
Expand All @@ -543,8 +543,8 @@ class H(SingleQubitGate):
>>> H(0).get_compact_qobj() # doctest: +NORMALIZE_WHITESPACE
Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True
Qobj data =
[[ 0.70710678 0.70710678]
[ 0.70710678 -0.70710678]]
[[ 0.70711 0.70711]
[ 0.70711 -0.70711]]
"""

def __init__(self, targets, **kwargs):
Expand Down Expand Up @@ -613,8 +613,8 @@ class T(SingleQubitGate):
>>> T(0).get_compact_qobj() # doctest: +NORMALIZE_WHITESPACE
Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = False
Qobj data =
[[1. +0.j 0. +0.j ]
[0. +0.j 0.70710678+0.70710678j]]
[[1. +0.j 0. +0.j ]
[0. +0.j 0.70711+0.70711j]]
"""

def __init__(self, targets, **kwargs):
Expand Down Expand Up @@ -743,10 +743,10 @@ class SQRTISWAP(TwoQubitGate):
>>> SQRTISWAP([0, 1]).get_compact_qobj() # doctest: +NORMALIZE_WHITESPACE
Quantum object: dims = [[2, 2], [2, 2]], shape = (4, 4), type = oper, isherm = False
Qobj data =
[[1. +0.j 0. +0.j 0. +0.j 0. +0.j ]
[0. +0.j 0.70710678+0.j 0. +0.70710678j 0. +0.j ]
[0. +0.j 0. +0.70710678j 0.70710678+0.j 0. +0.j ]
[0. +0.j 0. +0.j 0. +0.j 1. +0.j ]]
[[1. +0.j 0. +0.j 0. +0.j 0. +0.j ]
[0. +0.j 0.70711+0.j 0. +0.70711j 0. +0.j ]
[0. +0.j 0. +0.70711j 0.70711+0.j 0. +0.j ]
[0. +0.j 0. +0.j 0. +0.j 1. +0.j ]]
"""

def __init__(self, targets, **kwargs):
Expand Down Expand Up @@ -776,10 +776,10 @@ class BERKELEY(TwoQubitGate):
>>> BERKELEY([0, 1]).get_compact_qobj() # doctest: +NORMALIZE_WHITESPACE
Quantum object: dims = [[2, 2], [2, 2]], shape = (4, 4), type = oper, isherm = False
Qobj data =
[[0.92387953+0.j 0. +0.j 0. +0.j 0. +0.38268343j]
[0. +0.j 0.38268343+0.j 0. +0.92387953j 0. +0.j ]
[0. +0.j 0. +0.92387953j 0.38268343+0.j 0. +0.j ]
[0. +0.38268343j 0. +0.j 0. +0.j 0.92387953+0.j ]]
[[0.92388+0.j 0. +0.j 0. +0.j 0. +0.38268j]
[0. +0.j 0.38268+0.j 0. +0.92388j 0. +0.j ]
[0. +0.j 0. +0.92388j 0.38268+0.j 0. +0.j ]
[0. +0.38268j 0. +0.j 0. +0.j 0.92388+0.j ]]
"""

def __init__(self, targets, **kwargs):
Expand Down Expand Up @@ -842,10 +842,10 @@ class MS(TwoQubitGate):
>>> MS([0, 1], np.pi/2).get_compact_qobj() # doctest: +NORMALIZE_WHITESPACE
Quantum object: dims = [[2, 2], [2, 2]], shape = (4, 4), type = oper, isherm = False
Qobj data =
[[0.70710678+0.j 0. +0.j 0. +0.j 0. -0.70710678j]
[0. +0.j 0.70710678+0.j 0. -0.70710678j 0. +0.j ]
[0. +0.j 0. -0.70710678j 0.70710678+0.j 0. +0.j ]
[0. -0.70710678j 0. +0.j 0. +0.j 0.70710678+0.j ]]
[[0.70711+0.j 0. +0.j 0. +0.j 0. -0.70711j]
[0. +0.j 0.70711+0.j 0. -0.70711j 0. +0.j ]
[0. +0.j 0. -0.70711j 0.70711+0.j 0. +0.j ]
[0. -0.70711j 0. +0.j 0. +0.j 0.70711+0.j ]]
"""

def __init__(self, targets, arg_value, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion src/qutip_qip/operations/gates.py
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ def qubit_clifford_group(N=None, target=0):
(http://www.mathstat.dal.ca/~selinger/newsynth/).
Parameters
-----------
----------
N : int or None
Number of qubits on which each operator is to be defined
Expand Down
2 changes: 1 addition & 1 deletion src/qutip_qip/qubits.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def qubit_states(N=1, states=[0]):
Initial state of each qubit.
Returns
----------
-------
qstates : Qobj
List of qubits.
Expand Down

0 comments on commit 73c4a9b

Please sign in to comment.