Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I saw an algorithm in the paper<>that can be used to generate MRD codes. Then I try and run the gab_yz(2,2), the error occurres:

Hi, I saw an algorithm in the paper<<an algorithm="" to="" generate="" binary="" gabilin="" codes="" using="" sage="">>that can be used to generate MRD codes. Then I try and run the gab_yz(2,2), the error occurres:


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&lt;a" href="pp[y]">u ---> 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'

def gab_yz(m,K): n=m var('w,a') ratpoly. = 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)&lt;/p&gt; &lt;pre&gt;&lt;code&gt;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.&lt;x&gt;="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&lt;len(n):="" s="0" k="0" while="" k&lt;(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&lt;len(c):="" cl="[]" y="0" if="" u="=0:" while="" y&lt;len(pp):="" cc="0" y="y+1" cl+="[CC]" gab+="[CL]" else:="" while="" y&lt;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))="" <="" code="">

I saw an algorithm in the paper<>that can be used to generate MRD codes. Then I try and run the gab_yz(2,2), the error occurres:

Hi, I saw an algorithm in the paper<<an algorithm="" to="" generate="" binary="" gabilin="" codes="" using="" sage="">>that paper

An Algorithm To Generate Binary Gabilin Codes Using Sage

that can be used to generate MRD codes. Then codes.

When I try and run the gab_yz(2,2), the gab_yz(2, 2), this error occurres: 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&lt;a" href="pp[y]">u
y<len(pp):
     75                 CC=C[u](pp[y])
---> 76                 GP=CC.full_simplify()
     77                 y=y+Integer(1)
     78                 CL+=[R(CC)]

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):

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):

__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)

Python) AttributeError: 'sage.rings.polynomial.polynomial_zz_pex.Polynomial_ZZ_pEX' object has no attribute 'full_simplify''full_simplify'

Here is the definition of gab_yz:

def gab_yz(m,K):
    n=m
    var('w,a')
    ratpoly. 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)&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;pp=[]
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.&lt;x&gt;="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&lt;len(n):="" s="0" k="0" while="" k&lt;(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&lt;len(c):="" cl="[]" y="0" if="" u="=0:" while="" y&lt;len(pp):="" cc="0" y="y+1" cl+="[CC]" gab+="[CL]" else:="" while="" y&lt;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))="" <="" code="">

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))

I saw an algorithm in the paper<>that can be used to generate MRD codes. Then I try and run the gab_yz(2,2), the error occurres:

I saw an algorithm in the paper

An Algorithm To Generate Binary Gabilin Codes Using Sage

that can be used to generate MRD 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))

I saw an algorithm in the paper<>that can be used to generate Generating MRD codes. Then I try and run the gab_yz(2,2), the error occurres:codes

I saw an algorithm in the paper

Ismael Gutierrez Garcia; Yesneri Zuleta Saldarriaga.
"An algorithm to generate binary Gabidulin codes using Sage."
An Algorithm To Generate Binary Gabilin Codes Using SageIEEE Latin America Transactions, vol. 13, no. 5, pp. 1469-1477, May 2015,
doi: 10.1109/TLA.2015.7112004.

that can be used to generate MRD 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))

Generating MRD 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))