> R = some ring
> S = FactorCache(R)
>
> So now S is a ring, whose elements are products of elements of R.
> Multiplication does the obvious thing, addition and subtraction I
> suppose checks for common factors and just expands the rest? (I suppose
> this is very much like the Factorization class already in SAGE, except
> it would support arithmetic. Or maybe the Factorization class already
> supports arithmetic, I don't know.)
>
You are indeed correct that even under addition and subtraction it
would be possible to preserve common factors. This is an elegant
idea which would be easy to implement.  I don't know if it would
yield
any speedups for fraction fields.

I looked at the Factorization class but it was not optimized enough.
One thing I realized early on is that factor cacheing needs to *very*
fast
or it becomes a bottleneck in itself. For example I use "is" as
test for equality and not ==.


> Then you would just write
>
> K = FractionField(S)
>
> Would it even be necessary to write special code in the fraction field
> class if it was done this way? (Hmmm.... thinking aloud in public
> here....)

Well currently the module fraction_field_cache.py is almost the
same as  fraction_field.py.  So indeed very few changes are necessary.
One can possibly bring it down to zero but there are a few technical
points
like the meaning of is_one(). In factor_cache.pyx is_one() just means
zero
factors (anything else is too expensive). But for example to print a
fraction you need the real is_one(). So I use
_value(denominator).is_one()
(where _value(object) is the cached product).

So you idea is sensible but I don't know if there are really any other
applications
beyond fraction fields.

Michel






--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
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