upd: first version of *
This commit is contained in:
@ -15,14 +15,39 @@ class int2048 {
|
||||
* num_length is the length of the integer, (num_length+kNum-1)/kNum is the
|
||||
* length of val with data. Note that position in val without data is 0.
|
||||
*/
|
||||
size_t buf_length = 0;
|
||||
const static int kMod = 100000000, kNum = 8, kDefaultLength = 10;
|
||||
const static int kMemAdditionScalar = 2, kMemDeleteScalar = 4;
|
||||
/**
|
||||
* the follow data used by NTT is generated by this code:
|
||||
#!/usr/bin/python3
|
||||
from sympy import isprime,primitive_root
|
||||
found=False
|
||||
for i in range(0,20):
|
||||
for j in range(2**i,(2**(i+1))):
|
||||
V=j*(2**(57-i))+1
|
||||
if isprime(V):
|
||||
found=True
|
||||
print(j,57-i)
|
||||
print("number=",V)
|
||||
print("root=",primitive_root(V))
|
||||
exit(0)
|
||||
* it out puts:
|
||||
95 55
|
||||
number= 180143985094819841
|
||||
root= 6
|
||||
*/
|
||||
const static __int128_t kNTTMod = 180143985094819841ll;
|
||||
const static __int128_t kNTTRoot = 6;
|
||||
const static int kNTTBlockNum = 4;
|
||||
const static int kNTTBlcokBase = 10000;
|
||||
|
||||
size_t buf_length = 0;
|
||||
int *val = nullptr;
|
||||
signed char flag = +1;
|
||||
int num_length = 0;
|
||||
|
||||
void NTT(__int128_t *, int, int);
|
||||
__int128_t QuickPow(__int128_t v, long long q);
|
||||
void NTTTransform(__int128_t *, int, bool);
|
||||
|
||||
public:
|
||||
int2048();
|
||||
|
Reference in New Issue
Block a user