Skip to content

Commit

Permalink
Tiny simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn-martinsson committed Jul 9, 2023
1 parent dc477c8 commit 7f54a87
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pyrival/algebra/fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ def fft(P):

k = n
while k > 1:
for i in range(0, n, k):
r = rt[i//k]
for j1 in range(i, i + k//2):
for i in range(n//k):
r = rt[i]
for j1 in range(i*k, i*k + k//2):
j2 = j1 + k//2
z = r * P[j2]
P[j2] = P[j1] - z
Expand Down
6 changes: 3 additions & 3 deletions pyrival/algebra/ntt.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ def ntt(P):

k = n
while k > 1:
for i in range(0, n, k):
r = rt[i//k]
for j1 in range(i, i + k//2):
for i in range(n//k):
r = rt[i]
for j1 in range(i*k, i*k + k//2):
j2 = j1 + k//2
z = r * P[j2]
P[j2] = (P[j1] - z) % MOD
Expand Down

0 comments on commit 7f54a87

Please sign in to comment.