forked from alexstachnik/block-wiedemann-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
46 lines (38 loc) · 810 Bytes
/
main.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
46
import sys
from Algorithms import *
from Mat import *
from Modular import *
from Poly import *
from ScalarMassey import *
from MatWiedemann import *
from ScalarWiedemann import *
from PolyAlg import *
#Generates a random non-singular matrix and finds its min-poly by
#block-wiedemann and by scalar-wiedemann
field = Modular(101)
#field=Modular(536870909)
ring = Poly.Poly(field)
n=20
A=Mat.Mat(field,n,n)
A.randomize()
while A.det() == 0:
A.randomize()
print A.det()
b=5
U=Mat.Mat(field,b,n)
V=Mat.Mat(field,n,b)
U.randomize()
V.randomize()
print A.sage()
print "-"
f=fixedMatWiedemannWrapper(A,b,U,V)
f.reverse()
matPoly=polyMatToMatPoly(f,field)
det=matPoly.crappyDet()
det.reverse()
ring.normalize(det)
print det
print ""
otherPoly=wiedemann2Wrapper(A,field)
otherPoly.reverse()
print otherPoly