Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated requirements.txt and some test files for sympy 1.4 updates and qiskit 0.8.0 updates. #42

Merged
merged 56 commits into from Apr 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
d50b801
first
Oct 20, 2017
af99632
udpate core
Oct 20, 2017
14e5d05
update name
Oct 20, 2017
97774cc
update qubo and sqa
Oct 21, 2017
4b74156
Merge pull request #1 from mdrft/master
openql-org Oct 21, 2017
d220a55
update repeat calc
Oct 21, 2017
d2a7c55
update for repeat of trial and comments
Oct 21, 2017
5a4bfe3
update qubo and sqa separated
Oct 21, 2017
06437f5
update cost function
Oct 21, 2017
793006b
updated some comments
Oct 21, 2017
0b4e574
added some files to perform TravisCI and some fixed indent errors (#3)
kyamaz Oct 21, 2017
4db7a3f
merge mdrft's updates and the latest feature-hokusai (#5)
kyamaz Oct 21, 2017
15e031e
updates for feature-hokusai (#7)
kyamaz Dec 23, 2017
c8bbb70
qcsim integration (#8)
shukob Dec 24, 2017
6ed50a0
Modify IBMQExecutor and add ctor to BaseQuantumExecutor (#9)
gyu-don Dec 25, 2017
4dbca05
Feature hokusai (#10)
gyu-don Dec 25, 2017
6046ebb
added test files (#11)
kyamaz Dec 29, 2017
942eddd
fixed project files. (#12)
openql-org Jan 10, 2018
1a77952
Fix bugs in cpu simulator (#13)
kodack64 Jan 15, 2018
f8a88b3
add the feature of the expression that can be reversed multiply order…
shukob Jan 17, 2018
9820c63
added some comments in each python files (#15)
kyamaz Jan 17, 2018
cf87a6d
updated README.rst and added assert in test codes on the "ising" feat…
kyamaz Jan 24, 2018
1c8c019
delete ising program on `quantpy` directory
openql-org Jan 24, 2018
3642012
updated release.py to change the version from 0.0.1.dev1 to 0.0.2
openql-org Jan 24, 2018
e989199
prepare release of feature-hokusai (#18)
openql-org Jan 29, 2018
930db8a
Merge branch 'develop' into feature-hokusai
openql-org Jan 29, 2018
0063fc3
change release version to `0.0.2.dev2`
openql-org Jan 29, 2018
5ef0777
fixed bdist_wheel error and change release version to `0.0.2.dev3`
openql-org Jan 31, 2018
44d8c66
Merge branch 'develop' into feature-hokusai
openql-org Jan 31, 2018
fb772a2
Merge branch 'develop' into feature-hokusai
openql-org Jan 31, 2018
6d6f6d1
fixed typo in README.rst
openql-org Feb 7, 2018
aa82fc7
updated release version from 0.0.2.dev3 to 0.0.2.dev4
openql-org Feb 7, 2018
f1edcb5
Merge branch 'release-0.0.2' into feature-hokusai
openql-org Feb 7, 2018
ff58399
updated IBMExecutor and ClassicalSimulationExecutor to fix some bugs …
openql-org Feb 18, 2018
a78b0af
updated expr_extension.py and test code to add toggle/add/remove func…
openql-org Feb 21, 2018
96c0f77
updated expr_extension.py and test code to add toggle/add/remove func…
openql-org Feb 22, 2018
ad2f402
updated quantpy/sympy/tests/sympy/physics/quantum/test_spin.py from s…
openql-org Feb 28, 2018
3c5fcf2
- changed to_qasm function not to automatically transform to add mea…
openql-org Feb 28, 2018
121a4c5
- changed to_qasm function not to automatically transform to add mea…
openql-org Feb 28, 2018
a28df30
updated IBMQExecutor to handle qiskit._resulterror.ResultError
openql-org Feb 28, 2018
95561b6
- updated IBMQExecutor to handle qiskit._resulterror.ResultError
openql-org Feb 28, 2018
0650fec
Merge branch 'feature-hokusai' into feature/hokusai/examples
openql-org Mar 2, 2018
f63d3b7
added *include* option in to_qasm() of BaseQuantumExecutor
openql-org Mar 14, 2018
2907069
- added *include* option in to_qasm() of BaseQuantumExecutor
openql-org Mar 14, 2018
2d4216e
updated to adapt some files to able to calculate a controlled unitary…
openql-org May 21, 2018
75e4f14
updated to adapt some files to able to calculate a controlled unitary…
openql-org May 21, 2018
9dc50e4
Fix qiskit version incompatibility (#23)
shukob Jul 18, 2018
01758ca
Fix sympy compatibility in tests (#25)
shukob Jul 25, 2018
de56095
merge branch develop into feature-hokusai that updated release versio…
openql-org Jul 25, 2018
bf76c77
Pytest integration (#30)
ssmi1975 Dec 18, 2018
1ebb3f2
fix pytest integration (#31)
ssmi1975 Dec 19, 2018
db7dd81
Merge branch develop
openql-org Jan 16, 2019
647a513
Release 0.0.2 (#34) (#35)
openql-org Jan 16, 2019
7d00fe4
Ibmq fix (#37)
ssmi1975 Jan 23, 2019
9ae78cd
Merged develop into feature-hokusai
openql-org Jan 30, 2019
4b971fd
updated requirements.txt and some test files for sympy 1.4 updates an…
kyamaz Apr 10, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions quantpy/sympy/tests/sympy/physics/quantum/test_cg.py
@@ -1,11 +1,9 @@
from __future__ import division
from sympy import S, sqrt, Sum, symbols
from sympy.physics.quantum.cg import Wigner3j, Wigner6j, Wigner9j, CG, cg_simp
from sympy.functions.special.tensor_functions import KroneckerDelta
from sympy.utilities.pytest import slow


@slow
def test_cg_simp_add():
j, m1, m1p, m2, m2p = symbols('j m1 m1p m2 m2p')
# Test Varshalovich 8.7.1 Eq 1
Expand Down Expand Up @@ -169,9 +167,9 @@ def test_cg_simp_sum():


def test_doit():
assert Wigner3j(1/2, -1/2, 1/2, 1/2, 0, 0).doit() == -sqrt(2)/2
assert Wigner3j(S(1)/2, -S(1)/2, S(1)/2, S(1)/2, 0, 0).doit() == -sqrt(2)/2
assert Wigner6j(1, 2, 3, 2, 1, 2).doit() == sqrt(21)/105
assert Wigner6j(3, 1, 2, 2, 2, 1).doit() == sqrt(21) / 105
assert Wigner9j(
2, 1, 1, S(3)/2, S(1)/2, 1, S(1)/2, S(1)/2, 0).doit() == sqrt(2)/12
assert CG(1/2, 1/2, 1/2, -1/2, 1, 0).doit() == sqrt(2)/2
assert CG(S(1)/2, S(1)/2, S(1)/2, -S(1)/2, 1, 0).doit() == sqrt(2)/2
4 changes: 2 additions & 2 deletions quantpy/sympy/tests/sympy/physics/quantum/test_circuitplot.py
Expand Up @@ -7,8 +7,8 @@
mpl = import_module('matplotlib')

def test_render_label():
assert render_label('q0') == r'$|q0\rangle$'
assert render_label('q0', {'q0': '0'}) == r'$|q0\rangle=|0\rangle$'
assert render_label('q0') == r'$\left|q0\right\rangle$'
assert render_label('q0', {'q0': '0'}) == r'$\left|q0\right\rangle=\left|0\right\rangle$'

def test_Mz():
assert str(Mz(0)) == 'Mz(0)'
Expand Down
2 changes: 1 addition & 1 deletion quantpy/sympy/tests/sympy/physics/quantum/test_density.py
Expand Up @@ -159,7 +159,7 @@ def test_get_prob():
def test_entropy():
up = JzKet(S(1)/2, S(1)/2)
down = JzKet(S(1)/2, -S(1)/2)
d = Density((up, 0.5), (down, 0.5))
d = Density((up, S(1)/2), (down, S(1)/2))

# test for density object
ent = entropy(d)
Expand Down
4 changes: 2 additions & 2 deletions quantpy/sympy/tests/sympy/physics/quantum/test_gate.py
@@ -1,4 +1,4 @@
from sympy import exp, symbols, sqrt, I, pi, Mul, Integer, Wild
from sympy import exp, symbols, sqrt, I, pi, Mul, Integer, Wild, Rational
from sympy.core.compatibility import range
from sympy.matrices import Matrix, ImmutableMatrix

Expand Down Expand Up @@ -141,7 +141,7 @@ def test_UGate_OneQubitGate_combo():
assert represent(u1, nqubits=2) == cMat1

uMat2 = ImmutableMatrix([[1/sqrt(2), 1/sqrt(2)], [I/sqrt(2), -I/sqrt(2)]])
cMat2_1 = Matrix([[1/2 + I/2, 1/2 - I/2], [1/2 - I/2, 1/2 + I/2]])
cMat2_1 = Matrix([[Rational(1,2) + I/2, Rational(1, 2) - I/2], [Rational(1, 2) - I/2, Rational(1, 2) + I/2]])
cMat2_2 = Matrix([[1, 0], [0, I]])
u2 = UGate(0, uMat2)
assert represent(H(0)*u2, nqubits=1) == cMat2_1
Expand Down
24 changes: 12 additions & 12 deletions quantpy/sympy/tests/sympy/physics/quantum/test_grover.py
Expand Up @@ -11,17 +11,17 @@ def return_one_on_two(qubits):


def return_one_on_one(qubits):
return qubits == IntQubit(1, qubits.nqubits)
return qubits == IntQubit(1, nqubits=qubits.nqubits)


def test_superposition_basis():
nbits = 2
first_half_state = IntQubit(0, nbits)/2 + IntQubit(1, nbits)/2
first_half_state = IntQubit(0, nqubits=nbits)/2 + IntQubit(1, nqubits=nbits)/2
second_half_state = IntQubit(2, nbits)/2 + IntQubit(3, nbits)/2
assert first_half_state + second_half_state == superposition_basis(nbits)

nbits = 3
firstq = (1/sqrt(8))*IntQubit(0, nbits) + (1/sqrt(8))*IntQubit(1, nbits)
firstq = (1/sqrt(8))*IntQubit(0, nqubits=nbits) + (1/sqrt(8))*IntQubit(1, nqubits=nbits)
secondq = (1/sqrt(8))*IntQubit(2, nbits) + (1/sqrt(8))*IntQubit(3, nbits)
thirdq = (1/sqrt(8))*IntQubit(4, nbits) + (1/sqrt(8))*IntQubit(5, nbits)
fourthq = (1/sqrt(8))*IntQubit(6, nbits) + (1/sqrt(8))*IntQubit(7, nbits)
Expand All @@ -35,30 +35,30 @@ def test_OracleGate():

nbits = 2
v = OracleGate(2, return_one_on_two)
assert qapply(v*IntQubit(0, nbits)) == IntQubit(0, nbits)
assert qapply(v*IntQubit(1, nbits)) == IntQubit(1, nbits)
assert qapply(v*IntQubit(0, nbits)) == IntQubit(0, nqubits=nbits)
assert qapply(v*IntQubit(1, nbits)) == IntQubit(1, nqubits=nbits)
assert qapply(v*IntQubit(2, nbits)) == -IntQubit(2, nbits)
assert qapply(v*IntQubit(3, nbits)) == IntQubit(3, nbits)

# Due to a bug of IntQubit, this first assertion is buggy
# assert represent(OracleGate(1, lambda qubits: qubits == IntQubit(0)), nqubits=1) == \
# Matrix([[-1/sqrt(2), 0], [0, 1/sqrt(2)]])
assert represent(OracleGate(1, lambda qubits: qubits == IntQubit(0)), nqubits=1) == \
Matrix([[-1, 0], [0, 1]])
assert represent(v, nqubits=2) == Matrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]])


def test_WGate():
nqubits = 2
basis_states = superposition_basis(nqubits)
assert qapply(WGate(nqubits)*basis_states) == basis_states

expected = ((2/sqrt(pow(2, nqubits)))*basis_states) - IntQubit(1, nqubits)
assert qapply(WGate(nqubits)*IntQubit(1, nqubits)) == expected
expected = ((2/sqrt(pow(2, nqubits)))*basis_states) - IntQubit(1, nqubits=nqubits)
assert qapply(WGate(nqubits)*IntQubit(1, nqubits=nqubits)) == expected


def test_grover_iteration_1():
numqubits = 2
basis_states = superposition_basis(numqubits)
v = OracleGate(numqubits, return_one_on_one)
expected = IntQubit(1, numqubits)
expected = IntQubit(1, nqubits=numqubits)
assert qapply(grover_iteration(basis_states, v)) == expected


Expand All @@ -83,7 +83,7 @@ def test_grover_iteration_2():

def test_grover():
nqubits = 2
assert apply_grover(return_one_on_one, nqubits) == IntQubit(1, nqubits)
assert apply_grover(return_one_on_one, nqubits) == IntQubit(1, nqubits=nqubits)

nqubits = 4
basis_states = superposition_basis(nqubits)
Expand Down
11 changes: 10 additions & 1 deletion quantpy/sympy/tests/sympy/physics/quantum/test_identitysearch.py
@@ -1,5 +1,6 @@
from sympy.external import import_module
from sympy import Mul, Integer
from sympy.core.compatibility import PY3
from sympy.physics.quantum.dagger import Dagger
from sympy.physics.quantum.gate import (X, Y, Z, H, CNOT,
IdentityGate, CGate, PhaseGate, TGate)
Expand Down Expand Up @@ -483,10 +484,18 @@ def test_bfs_identity_search():
assert bfs_identity_search(gate_list, 1, max_depth=4) == id_set


@XFAIL
# @XFAIL
# Seems to fail on Python 2.7, but not 3.X, unless scipy is installed
def test_bfs_identity_search_xfail():
scipy = import_module('scipy', __import__kwargs={'fromlist': ['sparse']})
if scipy:
skip("scipy installed.")
s = PhaseGate(0)
t = TGate(0)
gate_list = [Dagger(s), t]
id_set = {GateIdentity(Dagger(s), t, t)}
assert bfs_identity_search(gate_list, 1, max_depth=3) == id_set


if not PY3:
test_bfs_identity_search_xfail = XFAIL(test_bfs_identity_search_xfail)
4 changes: 2 additions & 2 deletions quantpy/sympy/tests/sympy/physics/quantum/test_printing.py
Expand Up @@ -547,7 +547,7 @@ def test_operator():
assert pretty(d) == ascii_str
assert upretty(d) == ucode_str
assert latex(d) == \
r'DifferentialOperator\left(\frac{d}{d x} f{\left (x \right )},f{\left (x \right )}\right)'
r'DifferentialOperator\left(\frac{d}{d x} f{\left(x \right)},f{\left(x \right)}\right)'
sT(d, "DifferentialOperator(Derivative(Function('f')(Symbol('x')), Tuple(Symbol('x'), Integer(1))),Function('f')(Symbol('x')))")
assert str(b) == 'Operator(B,t,1/2)'
assert pretty(b) == 'Operator(B,t,1/2)'
Expand Down Expand Up @@ -822,7 +822,7 @@ def test_big_expr():
assert pretty(e1) == ascii_str
assert upretty(e1) == ucode_str
assert latex(e1) == \
r'{J_z^{2}}\otimes \left({A^{\dagger} + B^{\dagger}}\right) \left\{\left(DifferentialOperator\left(\frac{d}{d x} f{\left (x \right )},f{\left (x \right )}\right)^{\dagger}\right)^{3},A^{\dagger} + B^{\dagger}\right\} \left({\left\langle 1,0\right|} + {\left\langle 1,1\right|}\right) \left({\left|0,0\right\rangle } + {\left|1,-1\right\rangle }\right)'
r'{J_z^{2}}\otimes \left({A^{\dagger} + B^{\dagger}}\right) \left\{\left(DifferentialOperator\left(\frac{d}{d x} f{\left(x \right)},f{\left(x \right)}\right)^{\dagger}\right)^{3},A^{\dagger} + B^{\dagger}\right\} \left({\left\langle 1,0\right|} + {\left\langle 1,1\right|}\right) \left({\left|0,0\right\rangle } + {\left|1,-1\right\rangle }\right)'
sT(e1, "Mul(TensorProduct(Pow(JzOp(Symbol('J')), Integer(2)), Add(Dagger(Operator(Symbol('A'))), Dagger(Operator(Symbol('B'))))), AntiCommutator(Pow(Dagger(DifferentialOperator(Derivative(Function('f')(Symbol('x')), Tuple(Symbol('x'), Integer(1))),Function('f')(Symbol('x')))), Integer(3)),Add(Dagger(Operator(Symbol('A'))), Dagger(Operator(Symbol('B'))))), Add(JzBra(Integer(1),Integer(0)), JzBra(Integer(1),Integer(1))), Add(JzKet(Integer(0),Integer(0)), JzKet(Integer(1),Integer(-1))))")
assert str(e2) == '[Jz**2,A + B]*{E**(-2),Dagger(D)*Dagger(C)}*[J2,Jz]'
ascii_str = \
Expand Down
10 changes: 9 additions & 1 deletion quantpy/sympy/tests/sympy/physics/quantum/test_qapply.py
@@ -1,4 +1,4 @@
from sympy import I, Integer, sqrt, symbols
from sympy import I, Integer, sqrt, symbols, S, Mul

from sympy.physics.quantum.anticommutator import AntiCommutator
from sympy.physics.quantum.commutator import Commutator
Expand All @@ -8,6 +8,7 @@
from sympy.physics.quantum.operator import Operator
from quantpy.sympy.qapply import qapply
from sympy.physics.quantum.spin import Jx, Jy, Jz, Jplus, Jminus, J2, JzKet
from sympy.physics.quantum.tensorproduct import TensorProduct
from sympy.physics.quantum.state import Ket
from sympy.physics.quantum.density import Density
from sympy.physics.quantum.qubit import Qubit
Expand Down Expand Up @@ -117,3 +118,10 @@ def test_issue_6073():
def test_density():
d = Density([Jz*mo, 0.5], [Jz*po, 0.5])
assert qapply(d) == Density([-hbar*mo, 0.5], [hbar*po, 0.5])


def test_issue3044():
expr1 = TensorProduct(Jz*JzKet(S(2),S(-1))/sqrt(2), Jz*JzKet(S(1)/2,S(1)/2))
result = Mul(S(-1), S(1)/4, (2**(S(1)/2)), hbar**2)
result *= TensorProduct(JzKet(2,-1), JzKet(S(1)/2,S(1)/2))
assert qapply(expr1) == result
22 changes: 22 additions & 0 deletions quantpy/sympy/tests/sympy/physics/quantum/test_qubit.py
Expand Up @@ -53,6 +53,21 @@ def test_QubitBra():


def test_IntQubit():
# issue 9136
iqb = IntQubit(0, nqubits=1)
assert qubit_to_matrix(Qubit('0')) == qubit_to_matrix(iqb)

qb = Qubit('1010')
assert qubit_to_matrix(IntQubit(qb)) == qubit_to_matrix(qb)

iqb = IntQubit(1, nqubits=1)
assert qubit_to_matrix(Qubit('1')) == qubit_to_matrix(iqb)
assert qubit_to_matrix(IntQubit(1)) == qubit_to_matrix(iqb)

iqb = IntQubit(7, nqubits=4)
assert qubit_to_matrix(Qubit('0111')) == qubit_to_matrix(iqb)
assert qubit_to_matrix(IntQubit(7, 4)) == qubit_to_matrix(iqb)

iqb = IntQubit(8)
assert iqb.as_int() == 8
assert iqb.qubit_values == (1, 0, 0, 0)
Expand All @@ -76,6 +91,10 @@ def test_IntQubit():
assert iqb._eval_innerproduct_IntQubitBra(iqb_bra) == Integer(0)
raises(ValueError, lambda: IntQubit(4, 1))

raises(ValueError, lambda: IntQubit('5'))
raises(ValueError, lambda: IntQubit(5, '5'))
raises(ValueError, lambda: IntQubit(5, nqubits='5'))
raises(TypeError, lambda: IntQubit(5, bad_arg=True))

def test_superposition_of_states():
state = 1/sqrt(2)*Qubit('01') + 1/sqrt(2)*Qubit('10')
Expand Down Expand Up @@ -167,6 +186,9 @@ def test_measure_all():
assert measure_all(state2) == \
[(Qubit('00'), Rational(4, 5)), (Qubit('11'), Rational(1, 5))]

# from issue #12585
assert measure_all(qapply(Qubit('0'))) == [(Qubit('0'), 1)]


def test_eval_trace():
q1 = Qubit('10110')
Expand Down
69 changes: 34 additions & 35 deletions quantpy/sympy/tests/sympy/physics/quantum/test_spin.py
@@ -1,4 +1,3 @@
from __future__ import division
from sympy import cos, exp, expand, I, Matrix, pi, S, sin, sqrt, Sum, symbols
from sympy.abc import alpha, beta, gamma, j, m
from sympy.physics.quantum import hbar, represent, Commutator, InnerProduct
Expand Down Expand Up @@ -3423,15 +3422,15 @@ def test_rotation_small_d():
assert Rotation.d(S(1)/2, -S(1)/2, S(1)/2, pi/2).doit() == sqrt(2)/2
assert Rotation.d(S(1)/2, -S(1)/2, -S(1)/2, pi/2).doit() == sqrt(2)/2
# j = 1
assert Rotation.d(1, 1, 1, pi/2).doit() == 1/2
assert Rotation.d(1, 1, 1, pi/2).doit() == S(1)/2
assert Rotation.d(1, 1, 0, pi/2).doit() == -sqrt(2)/2
assert Rotation.d(1, 1, -1, pi/2).doit() == 1/2
assert Rotation.d(1, 1, -1, pi/2).doit() == S(1)/2
assert Rotation.d(1, 0, 1, pi/2).doit() == sqrt(2)/2
assert Rotation.d(1, 0, 0, pi/2).doit() == 0
assert Rotation.d(1, 0, -1, pi/2).doit() == -sqrt(2)/2
assert Rotation.d(1, -1, 1, pi/2).doit() == 1/2
assert Rotation.d(1, -1, 1, pi/2).doit() == S(1)/2
assert Rotation.d(1, -1, 0, pi/2).doit() == sqrt(2)/2
assert Rotation.d(1, -1, -1, pi/2).doit() == 1/2
assert Rotation.d(1, -1, -1, pi/2).doit() == S(1)/2
# j = 3/2
assert Rotation.d(S(3)/2, S(3)/2, S(3)/2, pi/2).doit() == sqrt(2)/4
assert Rotation.d(S(3)/2, S(3)/2, S(1)/2, pi/2).doit() == -sqrt(6)/4
Expand All @@ -3450,31 +3449,31 @@ def test_rotation_small_d():
assert Rotation.d(S(3)/2, -S(3)/2, -S(1)/2, pi/2).doit() == sqrt(6)/4
assert Rotation.d(S(3)/2, -S(3)/2, -S(3)/2, pi/2).doit() == sqrt(2)/4
# j = 2
assert Rotation.d(2, 2, 2, pi/2).doit() == 1/4
assert Rotation.d(2, 2, 1, pi/2).doit() == -1/2
assert Rotation.d(2, 2, 2, pi/2).doit() == S(1)/4
assert Rotation.d(2, 2, 1, pi/2).doit() == -S(1)/2
assert Rotation.d(2, 2, 0, pi/2).doit() == sqrt(6)/4
assert Rotation.d(2, 2, -1, pi/2).doit() == -1/2
assert Rotation.d(2, 2, -2, pi/2).doit() == 1/4
assert Rotation.d(2, 1, 2, pi/2).doit() == 1/2
assert Rotation.d(2, 1, 1, pi/2).doit() == -1/2
assert Rotation.d(2, 2, -1, pi/2).doit() == -S(1)/2
assert Rotation.d(2, 2, -2, pi/2).doit() == S(1)/4
assert Rotation.d(2, 1, 2, pi/2).doit() == S(1)/2
assert Rotation.d(2, 1, 1, pi/2).doit() == -S(1)/2
assert Rotation.d(2, 1, 0, pi/2).doit() == 0
assert Rotation.d(2, 1, -1, pi/2).doit() == 1/2
assert Rotation.d(2, 1, -2, pi/2).doit() == -1/2
assert Rotation.d(2, 1, -1, pi/2).doit() == S(1)/2
assert Rotation.d(2, 1, -2, pi/2).doit() == -S(1)/2
assert Rotation.d(2, 0, 2, pi/2).doit() == sqrt(6)/4
assert Rotation.d(2, 0, 1, pi/2).doit() == 0
assert Rotation.d(2, 0, 0, pi/2).doit() == -1/2
assert Rotation.d(2, 0, 0, pi/2).doit() == -S(1)/2
assert Rotation.d(2, 0, -1, pi/2).doit() == 0
assert Rotation.d(2, 0, -2, pi/2).doit() == sqrt(6)/4
assert Rotation.d(2, -1, 2, pi/2).doit() == 1/2
assert Rotation.d(2, -1, 1, pi/2).doit() == 1/2
assert Rotation.d(2, -1, 2, pi/2).doit() == S(1)/2
assert Rotation.d(2, -1, 1, pi/2).doit() == S(1)/2
assert Rotation.d(2, -1, 0, pi/2).doit() == 0
assert Rotation.d(2, -1, -1, pi/2).doit() == -1/2
assert Rotation.d(2, -1, -2, pi/2).doit() == -1/2
assert Rotation.d(2, -2, 2, pi/2).doit() == 1/4
assert Rotation.d(2, -2, 1, pi/2).doit() == 1/2
assert Rotation.d(2, -1, -1, pi/2).doit() == -S(1)/2
assert Rotation.d(2, -1, -2, pi/2).doit() == -S(1)/2
assert Rotation.d(2, -2, 2, pi/2).doit() == S(1)/4
assert Rotation.d(2, -2, 1, pi/2).doit() == S(1)/2
assert Rotation.d(2, -2, 0, pi/2).doit() == sqrt(6)/4
assert Rotation.d(2, -2, -1, pi/2).doit() == 1/2
assert Rotation.d(2, -2, -2, pi/2).doit() == 1/4
assert Rotation.d(2, -2, -1, pi/2).doit() == S(1)/2
assert Rotation.d(2, -2, -2, pi/2).doit() == S(1)/4


def test_rotation_d():
Expand Down Expand Up @@ -3601,15 +3600,15 @@ def test_rotation_d():
assert Rotation.D(
S(1)/2, -S(1)/2, -S(1)/2, pi/2, pi/2, pi/2).doit() == I*sqrt(2)/2
# j = 1
assert Rotation.D(1, 1, 1, pi/2, pi/2, pi/2).doit() == -1/2
assert Rotation.D(1, 1, 1, pi/2, pi/2, pi/2).doit() == -S(1)/2
assert Rotation.D(1, 1, 0, pi/2, pi/2, pi/2).doit() == I*sqrt(2)/2
assert Rotation.D(1, 1, -1, pi/2, pi/2, pi/2).doit() == 1/2
assert Rotation.D(1, 1, -1, pi/2, pi/2, pi/2).doit() == S(1)/2
assert Rotation.D(1, 0, 1, pi/2, pi/2, pi/2).doit() == -I*sqrt(2)/2
assert Rotation.D(1, 0, 0, pi/2, pi/2, pi/2).doit() == 0
assert Rotation.D(1, 0, -1, pi/2, pi/2, pi/2).doit() == -I*sqrt(2)/2
assert Rotation.D(1, -1, 1, pi/2, pi/2, pi/2).doit() == 1/2
assert Rotation.D(1, -1, 1, pi/2, pi/2, pi/2).doit() == S(1)/2
assert Rotation.D(1, -1, 0, pi/2, pi/2, pi/2).doit() == I*sqrt(2)/2
assert Rotation.D(1, -1, -1, pi/2, pi/2, pi/2).doit() == -1/2
assert Rotation.D(1, -1, -1, pi/2, pi/2, pi/2).doit() == -S(1)/2
# j = 3/2
assert Rotation.D(
S(3)/2, S(3)/2, S(3)/2, pi/2, pi/2, pi/2).doit() == I*sqrt(2)/4
Expand Down Expand Up @@ -3644,31 +3643,31 @@ def test_rotation_d():
assert Rotation.D(
S(3)/2, -S(3)/2, -S(3)/2, pi/2, pi/2, pi/2).doit() == -I*sqrt(2)/4
# j = 2
assert Rotation.D(2, 2, 2, pi/2, pi/2, pi/2).doit() == 1/4
assert Rotation.D(2, 2, 2, pi/2, pi/2, pi/2).doit() == S(1)/4
assert Rotation.D(2, 2, 1, pi/2, pi/2, pi/2).doit() == -I/2
assert Rotation.D(2, 2, 0, pi/2, pi/2, pi/2).doit() == -sqrt(6)/4
assert Rotation.D(2, 2, -1, pi/2, pi/2, pi/2).doit() == I/2
assert Rotation.D(2, 2, -2, pi/2, pi/2, pi/2).doit() == 1/4
assert Rotation.D(2, 2, -2, pi/2, pi/2, pi/2).doit() == S(1)/4
assert Rotation.D(2, 1, 2, pi/2, pi/2, pi/2).doit() == I/2
assert Rotation.D(2, 1, 1, pi/2, pi/2, pi/2).doit() == 1/2
assert Rotation.D(2, 1, 1, pi/2, pi/2, pi/2).doit() == S(1)/2
assert Rotation.D(2, 1, 0, pi/2, pi/2, pi/2).doit() == 0
assert Rotation.D(2, 1, -1, pi/2, pi/2, pi/2).doit() == 1/2
assert Rotation.D(2, 1, -1, pi/2, pi/2, pi/2).doit() == S(1)/2
assert Rotation.D(2, 1, -2, pi/2, pi/2, pi/2).doit() == -I/2
assert Rotation.D(2, 0, 2, pi/2, pi/2, pi/2).doit() == -sqrt(6)/4
assert Rotation.D(2, 0, 1, pi/2, pi/2, pi/2).doit() == 0
assert Rotation.D(2, 0, 0, pi/2, pi/2, pi/2).doit() == -1/2
assert Rotation.D(2, 0, 0, pi/2, pi/2, pi/2).doit() == -S(1)/2
assert Rotation.D(2, 0, -1, pi/2, pi/2, pi/2).doit() == 0
assert Rotation.D(2, 0, -2, pi/2, pi/2, pi/2).doit() == -sqrt(6)/4
assert Rotation.D(2, -1, 2, pi/2, pi/2, pi/2).doit() == -I/2
assert Rotation.D(2, -1, 1, pi/2, pi/2, pi/2).doit() == 1/2
assert Rotation.D(2, -1, 1, pi/2, pi/2, pi/2).doit() == S(1)/2
assert Rotation.D(2, -1, 0, pi/2, pi/2, pi/2).doit() == 0
assert Rotation.D(2, -1, -1, pi/2, pi/2, pi/2).doit() == 1/2
assert Rotation.D(2, -1, -1, pi/2, pi/2, pi/2).doit() == S(1)/2
assert Rotation.D(2, -1, -2, pi/2, pi/2, pi/2).doit() == I/2
assert Rotation.D(2, -2, 2, pi/2, pi/2, pi/2).doit() == 1/4
assert Rotation.D(2, -2, 2, pi/2, pi/2, pi/2).doit() == S(1)/4
assert Rotation.D(2, -2, 1, pi/2, pi/2, pi/2).doit() == I/2
assert Rotation.D(2, -2, 0, pi/2, pi/2, pi/2).doit() == -sqrt(6)/4
assert Rotation.D(2, -2, -1, pi/2, pi/2, pi/2).doit() == -I/2
assert Rotation.D(2, -2, -2, pi/2, pi/2, pi/2).doit() == 1/4
assert Rotation.D(2, -2, -2, pi/2, pi/2, pi/2).doit() == S(1)/4


def test_wignerd():
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
@@ -1,3 +1,3 @@
numpy
qiskit == 0.7.0
qiskit >= 0.7.0
sympy