Ask Your Question

Subhajit's profile - activity

2018-02-17 21:44:54 -0600 commented answer 'CyclicCode_with_category' object has no attribute 'gen_mat'

Thank you sir for helping me out.

2018-02-17 14:57:33 -0600 commented answer 'CyclicCode_with_category' object has no attribute 'gen_mat'

Thank you very much sir for your kind reply.

2018-02-17 14:56:30 -0600 received badge  Scholar (source)
2018-02-17 11:57:21 -0600 received badge  Student (source)
2018-02-16 13:57:20 -0600 received badge  Editor (source)
2018-02-16 07:23:53 -0600 asked a question '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 (https://hal.archives-ouvertes.fr/hal-...)).

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?