Ralf Hemmecke <[EMAIL PROTECTED]> writes: > 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.
Although I didn't look close enough, I think that might be worth it. > 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. No. But at least we could write: hesrg := if mdeg p < mdeg ts_v then halfExtendedSubResultantGcd2(ts_v,p)$P else halfExtendedSubResultantGcd1(p,ts_v)$P g := gcd(hesrg.coef, hesrg.gcd) (n, d) := ((hesrg.coef exquo g)::P, (hesrg.gcd exquo g)::P) or: g := gcd(n := hesrg.coef, d := hesrg.gcd) (n, d) := ((n exquo g)::P, (d exquo g)::P) but I think the latter is only for me... Both looks nicer to me than 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) ------------------------------------------------------------------------------- It seems that the following three definitions are the only ones where the result type encodes the name of the operation a second time: newpoly.spad.pamphlet:77: halfExtendedSubResultantGcd1: ($, $) -> Record(gcd: $, coef1: $) newpoly.spad.pamphlet:87: halfExtendedResultant1: ($, $) -> Record(resultant: R, coef1: $) prs.spad.pamphlet:143: semiSubResultantGcdEuclidean1: (polR, polR)->Record(coef1: polR, gcd: polR) I think we should consider renaming them. However, in my opinion, newpoly should go away anyway and be merged into the other polynomial domains properly: it says that it is a post facto extension in spirit, but SPAD doesn't have "extend"... It seems that the main usage of NewSparseUnivariatePolynomial is in NewSparseMultivariatePolynomial. Are the operations it exports useless elsewhere? I guess we should ask Marc at the workshop... Martin ------------------------------------------------------------------------- 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 open-axiom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open-axiom-devel