Hi folks, Alasdair reported an inconsistency in the finite field implementation. I have included his original report below.
For a finite field of, say 2^6 elements, an object representing an element of such a field has a method called int_repr() that returns the object's integer representation. However, if we are dealing with, say GF(7^100), an object representing an element of such a field doesn't have a corresponding int_repr() method. The report below includes such a method, which is meant to work for a finite field of any order. Should there be a ticket opened for this? Thoughts? On Sun, Mar 21, 2010 at 10:19 AM, Alasdair McAndrew <[email protected]> wrote: <SNIP> > You might also be interested in this > small code snippet for finite fields: > > -- > # intr(z) produces the integer representation of a field element for fields > of arbitrary size . > > def intr(z): > C=z.polynomial().coeffs() > fc=parent(z).characteristic() > tmp=0 > for i in range(len(C),0,-1): > tmp=fc*tmp+int(C[i-1]) > return tmp > -- > > The current finite field method "int_repr" only works for small fields; this > code has no restrictions on size, and returns an integer, not a string: > > -- > sage: F.<X>=GF(2^6) > sage: r=F.random_element() > sage: r.int_repr() > '33' > sage: intr(r) > 33 > sage: F.<X>=GF(7^100) > sage: r=F.random_element() > sage: intr(r) # int_repr is not defined for fields of this size > > 585192776464109050455426560173914293952277259393164410721815536793240691277587616027 > -- > > cheers, > Alasdair -- Regards Minh Van Nguyen -- To post to this group, send an email to [email protected] To unsubscribe from this group, send an email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org To unsubscribe from this group, send email to sage-devel+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
