-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathexperiment_LLL_profile.py
46 lines (35 loc) · 1.32 KB
/
experiment_LLL_profile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from numpy import zeros, matrix, array, random
from middleware import CodeRedLib
from time import time
from math import floor
def experiment(n, k, samples):
profiles = zeros((6, k))
G = random.randint(0,2, size=(k, n), dtype="bool")
red = CodeRedLib(G)
for s in range(samples):
red.Randomize()
red.LLL()
profiles[0] += array(sorted(list(red.l), reverse=True)) / (1.*samples)
red.Randomize()
red.Systematize()
profiles[1] += array(sorted(list(red.l), reverse=True)) / (1.*samples)
red.LLL()
profiles[2] += array(sorted(list(red.l), reverse=True)) / (1.*samples)
red.Randomize()
red.Systematize()
red.EpiSort()
profiles[3] += array(sorted(list(red.l), reverse=True)) / (1.*samples)
red.LLL()
profiles[4] += array(sorted(list(red.l), reverse=True)) / (1.*samples)
red.SizeRedBasis()
red.KillTwos()
profiles[5] += array(sorted(list(red.l), reverse=True)) / (1.*samples)
return profiles
n = 1280
k = int(n/2)
samples = 100
M = experiment(n, k, samples)
C = M.transpose()
print("index, pLLL_raw, pSys, pLLL_Sys, pSort, pLLL_Sort, pLLL_Sort_K2")
for i in range(25):
print(i+1, ", \t %.2f,\t %.2f,\t %.2f,\t %.2f,\t %.2f, \t %.2f \t"%tuple(C[i]))