On Sun, Aug 1, 2010 at 1:54 PM, Jeroen Demeyer <[email protected]> wrote:
> Hello sage-devel,
>
> I think we should think about NumberFieldFractionalIdeal.__repr__(),
> i.e. how to print an ideal in a number field.  Right now, we actually
> check whether the ideal is principal (and then use a generator to print
> the ideal).  This is very slow, especially with proof=True.  I see
> several sensible possibilities:
>
> 1) Ignore the problem and keep everything as it is.  Hope that users
> will be clever enough never to ask for the string representation of
> their ideals (there are other functions to get some other useful
> representations (I.integral_basis() for example) of the ideal).
>
> 2) Output the ideal in 2-generator form using idealtwoelt().
>
> 3) Output the ideal in HNF form using a Z-basis of the ring of integers.
>  Native format of PARI, so fastest possible.  This can get ugly though.
>
> 4) Use LLL and hope we find a generator of our ideal, see idealred()
> from PARI.  If we do not find a generator, we use the 2-element
> representation.
>
> 5) Some kind of mixed case where we do one of the above depending on the
> "complexity" of the number field in terms of degree and/or discriminant.
>  This will always lead to arbitrary boundaries though.
>
>
> I am personally in favor of 4), even if this goes against the
> "proof=True" philosophy (we might have a principal ideal where LLL does
> not find a generator).

I'm in favor of 5.  In fact, I made that change in my own local
version of number fields.
Print nicely, especially for fields of small discriminant and degree
-- e.g., quadratic fields where
people actually *look* at the printouts, and play around explicitly
with examples.   Otherwise, just print instantly.

If you're working on this code, make sure to define a __hash__ method
for ideals.
Right now, it defaults to hash(str(self)), which is INSANELY slow,
because computing
str(self) requires trying to fo find optimal generators.

>
>
> In any case, we can have an option on the NumberField constructor to
> decide how its ideals should be printed.  But then we still have to
> discuss what the default should be.
>
>
> Any ideas/suggestions?  Maybe something to discuss at Sage Days %d?
> Jeroen.
>
> --
> 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
>



-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

-- 
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

Reply via email to