added test
This commit is contained in:
parent
a1d73db471
commit
d73c088df7
1 changed files with 12 additions and 0 deletions
12
Gate_test.py
Normal file
12
Gate_test.py
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
from QElephant.QuBit import *
|
||||||
|
|
||||||
|
## for IQuBit
|
||||||
|
mq = MuBit(2)
|
||||||
|
q = mq[1]
|
||||||
|
|
||||||
|
X(q)
|
||||||
|
assert mq._MuBit__state == [0, 1, 0, 0]
|
||||||
|
H(q)
|
||||||
|
assert mq._MuBit__state == [1/math.sqrt(2), -1/math.sqrt(2), 0, 0]
|
||||||
|
CX(mq, 0, 1)
|
||||||
|
assert mq._MuBit__state == [1/math.sqrt(2), -1/math.sqrt(2), 0, 0]
|
||||||
Loading…
Reference in a new issue