On May 28, 2007, at 4:36 AM, Michel wrote:

>> Does this idea
>> only make sense over division rings?  Because it is sometimes nice to
>> do integer arithmetic and have everything factored, as well.
>
> The factor cache works of course for non-fields. There is not much
> point
> taking the fraction field of a field, is there:-) Naturally you can
> use it for integers but it would
> probably be very slow since integer arithmetic is already extremely
> fast.
> It is really meant for rings for which no specialized arithmetic is
> available.

Actually the gcd code in the most recent release of GMP is O(N^2).  
(This is supposed to be fixed in the upcoming GMP 5, but it may not  
be for several years).

So for example:

sage: a = ZZ.random_element(2**1000000)
sage: b = ZZ.random_element(2**1000000)
sage: c = ZZ.random_element(2**1000000)

sage: time x = a*b
CPU times: user 0.02 s, sys: 0.00 s, total: 0.02 s
Wall time: 0.02

sage: time x = 1/(a*b) + 1/(a*c)
CPU times: user 9.58 s, sys: 0.01 s, total: 9.59 s
Wall time: 9.59

Presumably if this was done in the factor cache fraction field it  
would be much faster.

I think the general case of a factor cache for rings could be useful  
in some situations, but I admit I'm at a loss to name any specific  
examples.

I think I would generally support including the code you are  
proposing, assuming a referee is happy with the code. (I insist  
however on the spelling "caching" rather than "cacheing" :-))

Qualification: obviously, if this ever gets integrated with the  
FractionField constructor, it should be only *optional*... I would  
expect there would be many applications where the caching would  
actually slow things down. What do you think about this?

David


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to