Skip to content

Commit ae9eaa3

Browse files
committed
Sorted import of adjusted module.
1 parent 976ed22 commit ae9eaa3

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

opensquirrel/MatrixExpander.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22

33
from opensquirrel.Common import Can1
4-
from opensquirrel.Gates import MultiQubitMatrixSemantic, SingleQubitAxisAngleSemantic, Semantic
4+
from opensquirrel.Gates import MultiQubitMatrixSemantic, Semantic, SingleQubitAxisAngleSemantic
55

66

77
# This should only be used for testing and on circuits with low number of qubits.
@@ -11,8 +11,7 @@ def getBigMatrix(semantic: Semantic, qubitOperands, totalQubits):
1111

1212
axis, angle, phase = semantic.axis, semantic.angle, semantic.phase
1313
result = np.kron(
14-
np.kron(np.eye(1 << (totalQubits - whichQubit - 1)), Can1(axis, angle, phase)), np.eye(1 <<
15-
whichQubit)
14+
np.kron(np.eye(1 << (totalQubits - whichQubit - 1)), Can1(axis, angle, phase)), np.eye(1 << whichQubit)
1615
)
1716
assert result.shape == (1 << totalQubits, 1 << totalQubits)
1817
return result
@@ -28,8 +27,7 @@ def getBigMatrix(semantic: Semantic, qubitOperands, totalQubits):
2827
for input in range(1 << totalQubits):
2928
smallMatrixCol = 0
3029
for i in range(len(qubitOperands)):
31-
smallMatrixCol |= ((input & (1 << qubitOperands[i])) >> qubitOperands[i]) << (len(qubitOperands) -
32-
1 - i)
30+
smallMatrixCol |= ((input & (1 << qubitOperands[i])) >> qubitOperands[i]) << (len(qubitOperands) - 1 - i)
3331

3432
col = m[:, smallMatrixCol]
3533

0 commit comments

Comments
 (0)