-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnsymmetric.py
More file actions
49 lines (41 loc) · 982 Bytes
/
nsymmetric.py
File metadata and controls
49 lines (41 loc) · 982 Bytes
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
47
48
49
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 19 20:32:54 2022
@author: asus
"""
import numpy as np
import math
import re
import galois
from dmin import*
###############################################################################
def nsymmetric(d, n):
[h, g]= dmin(d, n)
a=len(h)
H=[]
GF = galois.GF(2**n)
b = GF.primitive_element
for i in range (a):
c=h[i]
d=c[0]
e=b**d
f=e.minimal_poly()
l=f.coeffs
m=l.tolist()
H.append(m)
GF = galois.GF(2)
o = galois.Poly([1], field=GF)
for j in range (len(H)):
p=H[j]
q = galois.Poly( p , field=GF)
o = o*q
r = 2**((2**n)-1)+1
s=[int(i) for i in bin(r)[2:]]
t= galois.Poly( s , field=GF)
U = t // o
V=U.coeffs
u=V.tolist()
v=[item for sublist in h for item in sublist]
w=len(v)
x=2**w
return(x, u)