Generating Gabidulin codes
I saw an algorithm in the paper
Ismael Gutierrez Garcia; Yesneri Zuleta Saldarriaga.
"An algorithm to generate binary Gabidulin codes using Sage."
IEEE Latin America Transactions, vol. 13, no. 5, pp. 1469-1477, May 2015,
doi: 10.1109/TLA.2015.7112004.
that can be used to generate Gabidulin codes.
When I run gab_yz(2, 2)
, this error occurs:
------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-9-f7a4cca9f105> in <module>()
----> 1 gab_yz(Integer(3),Integer(2))
<ipython-input-8-54b8ef1a8277> in gab_yz(m, K)
74 while y<len(pp):
75 CC=C[u](pp[y])
---> 76 GP=CC.full_simplify()
77 y=y+Integer(1)
78 CL+=[R(CC)]
/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/structure/element.pyx in sage.structure.element.Element.__getattr__ (build/cythonized/sage/structure/element.c:4609)()
485 AttributeError: 'LeftZeroSemigroup_with_category.element_class' object has no attribute 'blah_blah'
486 """
--> 487 return self.getattr_from_category(name)
488
489 cdef getattr_from_category(self, name):
/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/structure/element.pyx in sage.structure.element.Element.getattr_from_category (build/cythonized/sage/structure/element.c:4718)()
498 else:
499 cls = P._abstract_element_class
--> 500 return getattr_from_other_class(self, cls, name)
501
502 def __dir__(self):
/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/cpython/getattr.pyx in sage.cpython.getattr.getattr_from_other_class (build/cythonized/sage/cpython/getattr.c:2614)()
392 dummy_error_message.cls = type(self)
393 dummy_error_message.name = name
--> 394 raise AttributeError(dummy_error_message)
395 attribute = <object>attr
396 # Check for a descriptor (__get__ in Python)
AttributeError: 'sage.rings.polynomial.polynomial_zz_pex.Polynomial_ZZ_pEX' object has no attribute 'full_simplify'
Here is the definition of gab_yz
:
def gab_yz(m,K):
n=m
var('w,a')
ratpoly.<a> = PolynomialRing(ZZ)
qq=2^(n)
GG=GF(qq,'a')
Z=GG.list()
nset=[y for y in Z if y!=0]
N=Combinations(nset,n).list()
U=[vector(z) for z in Z]
mset = [w for w in U if w!=0]
M=Combinations(mset,n).list()
Q=[]
i=0
while i<len(M):
V=VectorSpace(GF(2), n)
V= V.subspace(M[i])
base=V.basis()
if len(base)==n:
Q+=[M[i]]
else:
Q+=[base]
i=i+1
j=randint(0,len(M)-1)
NL=Q[j]
print('Linearly independent vectors NL=', NL)
pp=[]
for t in range(len(NL)):
ss=0
for g in range(n):
ss+=NL[t][g]*(a^g)
pp+=[ss]
print('Linearly independent vectors in polynomial representation', pp)
mj=K
r=m
d=mj-1
q=2^(r)
G= GF(q,'a')
ratpoly.<x> = PolynomialRing(ZZ)
L=list(G)
N=Tuples(L,d+1).list()
C=[]
print('Linearized polynomial of linear degree less than',mj,':')
ii=0
while ii<len(N):
s=0
k=0
while k<(d+1):
s+=N[ii][k]*(x^2^(k))
k=k+1
ii=ii+1
print(' ',s)
C+=[s]
print('Number of linearized polynomial', len(C))
GAB=[]
CC=[]
SS=[]
R=PolynomialRing(Zmod(2),'a')
l=0
u=0
while u<len(C):
CL=[]
y=0
if u==0:
while y<len(pp):
CC=0
y=y+1
CL+=[CC]
GAB+=[CL]
else:
while y<len(pp):
CC=C[u](pp[y])
GP=CC.full_simplify()
y=y+1
CL+=[R(CC)]
GAB+=[CL]
u=u+1
print('The Gabidulin code with parameters' ,[n,mj,n-mj+1],'is:')
print('CODE_GAB=',GAB)
print('Number of codeword is:',len(GA))