Bill Allombert on Tue, 05 Aug 2008 14:52:02 +0200

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [ Re: bugfix for charpoly with finite fields]

On Fri, Aug 01, 2008 at 02:42:11AM +0200, Karim Belabas wrote:
> -- It would be very, very nice if polynomials (and matrices) carried
> with them their coefficient ring, without our trying to guess in each
> single function where exactly we are working (often giving up).
> Knowing precisely "what is 0" would be useful in many contexts: our
> current approach is too conservative and misses simplifications, as
> above. But I do not want to force users to specify base rings in advance
> or use complicated install-ed functions from libpari; so I'm stuck there.
> Maybe adding a "domain" tag to each object whenever we can safely do so
> would be doable. But can't be done without wrecking backward compatibility.
> (Or introducing completely new types.)

We do not have to break backward compatibility in any way. Consider a
GP object as being a tuple (domain,data1,data2,...).

For example 5 would be (Z,5) , 2 mod 7 would be (Fp,2,7), x+1 would be
(ZX,x+1), their sum would be (FpX,x+3,7) etc...

Then for all generic functions and all domains of its operand we would
have a definition giving the domain of the result and how to compute it:

For example the sum of x+1 and Mod(2,7) would be given by the rule:

(ZX, P)+(Fp, n, p)->(FpX, FpX_Fp_add(FpX_red(P,p),n,p), p)

We will have to make sure the rules follow what the current generic
functions do.

The only painful case is with vector affectation like v[i]=... which can
change the domain of v and require a full reencoding instead of an

Nothing really difficult, just really tedious.