On Nov 4, 2011, at 20:38 , juaninf wrote:

> Dears.
> 
> In this code
> 
> F.<a> = GF(2^(4))
> PR = PolynomialRing(F,'X')
> M = vector(PR,8)
> #get a g1
> g1 = (X + 1) * (X + a) * (X + a^3) * (X + a^5) * (X + a^5 + a^4 + a^3
> + a) * (X + a^6 + a^5 + a^4 + a^2) * (X + a^7 + a^2 + a + 1) * (X +
> a^7 + a^6 + a^5 + a^3)
> for i in range(self.8):
>    M[i]=g1.factor()[i]

Try this:
for i in range(len(M)):
   M[i] = g1.factor()[i]

A couple of things to note: first, this is inefficient, since you are factoring 
g1 n times, where n is the number of factors; and second, 'self' is probably 
not what you want to use in this code (and, at least in this code snippet, it's 
undefined).

Assuming I understand the intent of the loop above, you are duplicating effort. 
 The following has the same effect (and you don't need the line "M = 
vector(...)").

M = g1.factor()

HTH

Justin

--
Justin C. Walker
Curmudgeon-at-large
Director
Institute for the Absorption of Federal Funds
----
186,000 Miles per Second
Not just a good idea:
  it's the law!
----

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to