Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Issues with Reed-Solomon encoder

I am trying out the Reed-Solomon encoder in Sage and I have found it to exhibit a curious behavior. I first create an encoder for a $(7,3)$-Reed Solomon code as follows

sage: F.<a> = GF(8,name='a',modulus=x^3+x+1)
....: Fx.<x> = F[]
....: C = codes.ReedSolomonCode(F, 7, 3)
....: E = C.encoder("EvaluationPolynomial")

Now I can write

sage: E.encode(x)
(1, a, a^2, a + 1, a^2 + a, a^2 + a + 1, a^2 + 1)

Or

sage: E.encode(a*x^0+a^2*x+x^2)
(a^2 + a + 1, a^2 + 1, a, 0, a^2 + 1, 0, a^2 + a + 1)

But I get when I write the following

sage: E.encode(a)

I get the following error

"AttributeError: 'sage.rings.finite_rings.element_givaro.FiniteField_givaroElement' object has no attribute 'degree'"

If I instead write

sage: E.encode(a*x^0)

Everything works as intended. Is this how it is supposed to work? Does one always need an "$x$" to be part of a term, even when one actually has a constant term? Is there a better way to do it?