Ask Your Question

Revision history [back]

'CyclicCode_with_category' object has no attribute 'gen_mat'

I am trying to create the generator matrix for Quadratic Residue code and the code I am using is: def gen_matrices(n): C = Codes.QuadraticResidueCode(n, GF(2)) D = C.dual_code() G = C.gen_mat() H = D.gen_mat() J = G.transpose() * (G * G.transpose())^-1 K = H.transpose() * (H * H.transpose())^-1

T e s t i n g s u p p l eme n t a r i t y and d u a l i t y

o f code s C & D ( v a l i d by d e s i g n )

if rank(block_matrix([[G],[H]]))!=G.ncols()\ or G * H.transpose ()!=0: raise("Logic error: The code is not LCD") return [ G, H, J, K ]

When I am trying to run this code the 'CyclicCode_with_category' object has no attribute 'gen_mat' Can someone please help?

'CyclicCode_with_category' object has no attribute 'gen_mat'

I am trying to create the generator matrix for Quadratic Residue code and the code I am using is: is:

def gen_matrices(n): gen_matrices(n):

C = Codes.QuadraticResidueCode(n, GF(2)) GF(2))

D = C.dual_code() C.dual_code()

G = C.gen_mat() C.gen_mat()

H = D.gen_mat() D.gen_mat()

J = G.transpose() * (G * G.transpose())^-1 G.transpose())^-1

K = H.transpose() * (H * H.transpose())^-1

T e s t i n g s u p p l eme n t a r i t y and d u a l i t y

o f code s C & D ( v a l i d by d e s i g n )

if rank(block_matrix([[G],[H]]))!=G.ncols()\

if rank(block_matrix([[G],[H]]))!=G.ncols()\ or G * H.transpose ()!=0: ()!=0:

raise("Logic error: The code is not LCD") LCD")

return [ G, H, J, K ]

When I am trying to run this code the 'CyclicCode_with_category' object has no attribute 'gen_mat' Can someone please help?

'CyclicCode_with_category' object has no attribute 'gen_mat'

I am trying to create the generator matrix for Quadratic Residue code and the code I am using is:

def gen_matrices(n):

gen_matrices(n): C = Codes.QuadraticResidueCode(n, GF(2))

GF(2)) D = C.dual_code()

C.dual_code() G = C.gen_mat()

C.gen_mat() H = D.gen_mat()

D.gen_mat() J = G.transpose() * (G * G.transpose())^-1

G.transpose())^-1 K = H.transpose() * (H * H.transpose())^-1

H.transpose())^-1 if rank(block_matrix([[G],[H]]))!=G.ncols()\

rank(block_matrix([[G],[H]]))!=G.ncols()\ or G * H.transpose ()!=0:

()!=0: raise("Logic error: The code is not LCD")

LCD") return [ G, H, J, K ]

]

When But then I am trying to run this code getting the following error:

AttributeError                            Traceback (most recent call last)
<ipython-input-2-68b96fb2983c> in <module>()
----> 1 gen_matrices(Integer(17))

<ipython-input-1-f09fbcf52b0e> in gen_matrices(n)
      2   C = codes.QuadraticResidueCode(n, GF(Integer(2)))
      3   D = C.dual_code()
----> 4   G = C.gen_mat()
      5   H = D.gen_mat()
      6   J = G.transpose() * (G * G.transpose())**-Integer(1)

/opt/sagemath-8.1/src/sage/structure/category_object.pyx in sage.structure.categ                                                                    ory_object.CategoryObject.__getattr__ (build/cythonized/sage/structure/category_                                                                    object.c:8014)()
    854             AttributeError: 'PrimeNumbers_with_category' object has no a                                                                    ttribute 'sadfasdf'
    855         """
--> 856         return self.getattr_from_category(name)
    857
    858     cdef getattr_from_category(self, name):

/opt/sagemath-8.1/src/sage/structure/category_object.pyx in sage.structure.categ                                                                    ory_object.CategoryObject.getattr_from_category (build/cythonized/sage/structure                                                                    /category_object.c:8177)()
    869                 cls = self._category.parent_class
    870
--> 871             attr = getattr_from_other_class(self, cls, name)
    872             self.__cached_methods[name] = attr
    873             return attr

/opt/sagemath-8.1/src/sage/cpython/getattr.pyx in sage.cpython.getattr.getattr_f                                                                    rom_other_class (build/cythonized/sage/cpython/getattr.c:1837)()
    247         dummy_error_message.cls = type(self)
    248         dummy_error_message.name = name
--> 249         raise dummy_attribute_error
    250     cdef PyObject* attr = _PyType_Lookup(<type>cls, name)
    251     if attr is NULL:

AttributeError: 'CyclicCode_with_category' object has no attribute 'gen_mat'

Can someone anyone please help?suggest what I need to do?

'CyclicCode_with_category' object has no attribute 'gen_mat'

I am trying to create the generator matrix for Quadratic Residue code and the code I am using is:

def gen_matrices(n):
 C = Codes.QuadraticResidueCode(n, GF(2))       
codes.QuadraticResidueCode(n, GF(2))
    D = C.dual_code()
 G = C.gen_mat()
 H = D.gen_mat()
 J = G.transpose() * (G * G.transpose())^-1
 K = H.transpose() * (H * H.transpose())^-1
 if rank(block_matrix([[G],[H]]))!=G.ncols()\
 or G * H.transpose ()!=0:
 raise("Logic error: The code is not LCD")
 return [ G, H, J, K ]

gen_matrices(17)

But then Here I am first generating the QR code, where G is the generator matrix for the code C and H is the generator matrix for the cyclic code D. So after the encoding is done we now do XOR operation of the two codes - z = xG (XOR) yH. Now I want to do decoding and here J and K are the matrices which are used for doing decoding. Here J is given by J = G.Transpose(GG.Transpose)^-1.

Here I am running a code that is being used in a paper. The paper is (https://hal.archives-ouvertes.fr/hal-01240242/document).

When I am running the code I am getting the following error:

AttributeError                            Traceback (most recent call last)
<ipython-input-2-68b96fb2983c> in <module>()
----> 1 gen_matrices(Integer(17))

<ipython-input-1-f09fbcf52b0e> in gen_matrices(n)
      2   C = codes.QuadraticResidueCode(n, GF(Integer(2)))
      3   D = C.dual_code()
----> 4   G = C.gen_mat()
      5   H = D.gen_mat()
      6   J = G.transpose() * (G * G.transpose())**-Integer(1)

/opt/sagemath-8.1/src/sage/structure/category_object.pyx in sage.structure.categ                                                                    ory_object.CategoryObject.__getattr__ (build/cythonized/sage/structure/category_                                                                    object.c:8014)()
    854             AttributeError: 'PrimeNumbers_with_category' object has no a                                                                    ttribute 'sadfasdf'
    855         """
--> 856         return self.getattr_from_category(name)
    857
    858     cdef getattr_from_category(self, name):

/opt/sagemath-8.1/src/sage/structure/category_object.pyx in sage.structure.categ                                                                    ory_object.CategoryObject.getattr_from_category (build/cythonized/sage/structure                                                                    /category_object.c:8177)()
    869                 cls = self._category.parent_class
    870
--> 871             attr = getattr_from_other_class(self, cls, name)
    872             self.__cached_methods[name] = attr
    873             return attr

/opt/sagemath-8.1/src/sage/cpython/getattr.pyx in sage.cpython.getattr.getattr_f                                                                    rom_other_class (build/cythonized/sage/cpython/getattr.c:1837)()
    247         dummy_error_message.cls = type(self)
    248         dummy_error_message.name = name
--> 249         raise dummy_attribute_error
    250     cdef PyObject* attr = _PyType_Lookup(<type>cls, name)
    251     if attr is NULL:

AttributeError: 'CyclicCode_with_category' object has no attribute 'gen_mat'

Can anyone please suggest what I need to do?

'CyclicCode_with_category' object has no attribute 'gen_mat'

I am trying to create the generator matrix for Quadratic Residue code and the code I am using is:

def gen_matrices(n):
    C = codes.QuadraticResidueCode(n, GF(2))
    D = C.dual_code()

    G = C.gen_mat()
    H = D.gen_mat()
    J = G.transpose() * (G * G.transpose())^-1
    K = H.transpose() * (H * H.transpose())^-1


    if rank(block_matrix([[G],[H]]))!=G.ncols()\
        or G * H.transpose ()!=0:
        raise("Logic error: The code is not LCD")
    return [ G, H, J, K ]

gen_matrices(17)

Here I am first generating the QR code, where G is the generator matrix for the code C and H is the generator matrix for the cyclic code D. So after the encoding is done we now do XOR operation of the two codes - z = xG (XOR) yH. Now I want to do decoding and here J and K are the matrices which are used for doing decoding. Here J is given by J = G.Transpose(GG.Transpose)^-1.

Here I am running a code that is being used in a paper. The paper is (https://hal.archives-ouvertes.fr/hal-01240242/document).

When I am running the code I am getting the following error:

AttributeError                            Traceback (most recent call last)
<ipython-input-2-68b96fb2983c> in <module>()
----> 1 gen_matrices(Integer(17))

<ipython-input-1-f09fbcf52b0e> in gen_matrices(n)
      2   C = codes.QuadraticResidueCode(n, GF(Integer(2)))
      3   D = C.dual_code()
----> 4   G = C.gen_mat()
      5   H = D.gen_mat()
      6   J = G.transpose() * (G * G.transpose())**-Integer(1)

/opt/sagemath-8.1/src/sage/structure/category_object.pyx in sage.structure.categ                                                                    ory_object.CategoryObject.__getattr__ (build/cythonized/sage/structure/category_                                                                    object.c:8014)()
    854             AttributeError: 'PrimeNumbers_with_category' object has no a                                                                    ttribute 'sadfasdf'
    855         """
--> 856         return self.getattr_from_category(name)
    857
    858     cdef getattr_from_category(self, name):

/opt/sagemath-8.1/src/sage/structure/category_object.pyx in sage.structure.categ                                                                    ory_object.CategoryObject.getattr_from_category (build/cythonized/sage/structure                                                                    /category_object.c:8177)()
    869                 cls = self._category.parent_class
    870
--> 871             attr = getattr_from_other_class(self, cls, name)
    872             self.__cached_methods[name] = attr
    873             return attr

/opt/sagemath-8.1/src/sage/cpython/getattr.pyx in sage.cpython.getattr.getattr_f                                                                    rom_other_class (build/cythonized/sage/cpython/getattr.c:1837)()
    247         dummy_error_message.cls = type(self)
    248         dummy_error_message.name = name
--> 249         raise dummy_attribute_error
    250     cdef PyObject* attr = _PyType_Lookup(<type>cls, name)
    251     if attr is NULL:

AttributeError: 'CyclicCode_with_category' object has no attribute 'gen_mat'

Can anyone please suggest what I need to do?