Skip to content

Commit

Permalink
feat: improved exponent calculation for numba
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoLiegiBastonLiegi committed Mar 5, 2024
1 parent 5b2cc23 commit e658274
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/qibojit/backends/clifford_operations_cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,18 +268,11 @@ def _rowsum(symplectic_matrix, h, i, nqubits, determined=False):
g_xi_xh = xi.copy()
g_zi_zh = xi.copy()
for j in prange(len(h)): # pylint: disable=not-an-iterable
exp = np.zeros(nqubits, dtype=uint64)
x1_eq_z1 = (xi[j] ^ zi[j]) == False
x1_neq_z1 = ~x1_eq_z1
x1_eq_0 = xi[j] == False
x1_eq_1 = ~x1_eq_0
ind2 = x1_eq_z1 & x1_eq_1
ind3 = x1_eq_1 & x1_neq_z1
ind4 = x1_eq_0 & x1_neq_z1
exp[ind2] = zh[j, ind2].astype(uint64) - xh[j, ind2].astype(uint64)
exp[ind3] = zh[j, ind3].astype(uint64) * (2 * xh[j, ind3].astype(uint64) - 1)
exp[ind4] = xh[j, ind4].astype(uint64) * (1 - 2 * zh[j, ind4].astype(uint64))

exp = (
2 * (xi[j] * xh[j] * (zh[j] - zi[j]) + zi[j] * zh[j] * (xi[j] - xh[j]))
- xi[j] * zh[j]
+ xh[j] * zi[j]
)
r = (
2 * symplectic_matrix[h[j], -1]
+ 2 * symplectic_matrix[i[j], -1]
Expand Down

0 comments on commit e658274

Please sign in to comment.