Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Python3/Polynomials/64bit-fftmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def pack(pack, shamt):
npack += [pack[-1]]
pack, size, shamt = npack, (size + 1) >> 1, shamt << 1
return pack[0]

#for unpacking u can use the python inbuilt function t do it
def unpack(M, size, shamt):
s, sizes = size, []
while s > 1:
Expand All @@ -38,4 +38,4 @@ def poly_mul(f, g, mod = 1000000007):
shift = ((mod - 1) ** 2 * size).bit_length()
rsize = len(f) + len(g) - 1
h = unpack(pack(f, shift) * pack(g, shift), rsize, shift * (1 << ilog2(rsize - 1)))
return [int(x % mod) for x in h]
return [int(x % mod) for x in h]