To me the problem is bad design.
halfExtendedSubResultantGcd1 and
halfExtendedSubResultantGcd2 could well have returned the same type
Record(gcd: P, coef: P). By the name of the function it would have been
clear how to interpret the coef entry.
In fact, I would rather have liked that both functions simply return a
multivalue or a Cross(P, P), but unfortunately, that does not work in
panAxiom.
If you look closely, then
g := if mdeg p < mdeg ts_v
then gcd halfExtendedSubResultantGcd2(ts_v,p)$P
else gcd halfExtendedSubResultantGcd1(p,ts_v)$P
would then have been a shorter version of the "if" including the
following "g:=gcd(n,d)". But I guess that does not yet work in SPAD.
On 05/14/2008 03:27 PM, Gabriel Dos Reis wrote:
> The definition of the function recip$NormalizationPackage elicites
> a `semantic error' from the compiler because the local variable
> `hesrg' is defined in the two branches of an if-statement with two
> differen types. That looks like a bug to me. Opinion?
>
> recip(p:P,ts:TS): Record(num:P, den:P) ==
> -- ASSUME p is invertible w.r.t. ts
> -- ASSUME mvar(p) is algebraic w.r.t. ts
> v := mvar(p)
> ts_v := select(ts,v)::P
> if mdeg(p) < mdeg(ts_v)
> then
> hesrg: Record (gcd : P, coef2 : P) :=
> halfExtendedSubResultantGcd2(ts_v,p)$P
> d: P := hesrg.gcd; n: P := hesrg.coef2
> else
> hesrg: Record (gcd : P, coef1 : P) :=
> halfExtendedSubResultantGcd1(p,ts_v)$P
> d: P := hesrg.gcd; n: P := hesrg.coef1
> g := gcd(n,d)
> (n, d) := ((n exquo g)::P, (d exquo g)::P)
> remn, remd: Record(rnum:R,polnum:P,den:R)
> remn := remainder(n,ts); remd := remainder(d,ts)
> cn := remn.rnum; pn := remn.polnum; dn := remn.den
> cd := remd.rnum; pd := remd.polnum; dp := remd.den
> k: K := (cn / cd) * (dp / dn)
> pn := removeZero(pn,ts)
> pd := removeZero(pd,ts)
> [numer(k) * pn, denom(k) * pd]$Record(num:P, den:P)
>
>
> -- Gaby
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> open-axiom-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/open-axiom-devel
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
open-axiom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel