图片解析应用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

21 lines
666 B

from sympy.testing.pytest import XFAIL
from sympy.physics.quantum.qapply import qapply
from sympy.physics.quantum.qubit import Qubit
from sympy.physics.quantum.shor import CMod, getr
@XFAIL
def test_CMod():
assert qapply(CMod(4, 2, 2)*Qubit(0, 0, 1, 0, 0, 0, 0, 0)) == \
Qubit(0, 0, 1, 0, 0, 0, 0, 0)
assert qapply(CMod(5, 5, 7)*Qubit(0, 0, 1, 0, 0, 0, 0, 0, 0, 0)) == \
Qubit(0, 0, 1, 0, 0, 0, 0, 0, 1, 0)
assert qapply(CMod(3, 2, 3)*Qubit(0, 1, 0, 0, 0, 0)) == \
Qubit(0, 1, 0, 0, 0, 1)
def test_continued_frac():
assert getr(513, 1024, 10) == 2
assert getr(169, 1024, 11) == 6
assert getr(314, 4096, 16) == 13