Skip to content
Permalink
Browse files

updated requirements.txt and some test files for sympy 1.4 updates a…

…nd qiskit 0.8.0 updates. (#42)

* updated requirements.txt and some test files for sympy 1.4 updates and qiskit 0.8.0 updates. (#41)
  • Loading branch information...
openql-org committed Apr 10, 2019
1 parent 5577228 commit 554a5b09bc0d0354d6b6bfd7c51e793d5547257e
@@ -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
@@ -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
@@ -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)'
@@ -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)
@@ -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

@@ -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
@@ -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)
@@ -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


@@ -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)
@@ -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)
@@ -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)
@@ -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)'
@@ -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 = \
@@ -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
@@ -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
@@ -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
@@ -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)
@@ -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')
@@ -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')
@@ -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
@@ -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
@@ -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():
@@ -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
@@ -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():
@@ -1,3 +1,3 @@
numpy
qiskit == 0.7.0
qiskit >= 0.7.0
sympy

0 comments on commit 554a5b0

Please sign in to comment.
You can’t perform that action at this time.