I don't like this. If you specify that p and q have to be non-zero, then checking in code is just a safety check that supports either users that do not want to read the specification or you want to add a security meassure for cases when sylvesterMatrix is used as a sub-routine and is called with zero arguments. That's, of course a bug, but not a bug in sylvesterMatrix, but in the calling program.
I'm not a fan of (randomly) checking for conditions of arguments that (according to the specification) should never be given. Admittedly your test is not time consuming, but is by specification unnecessary. BTW, why "p=0" instead of "zero?(p)". Ralf On 03/01/2017 09:21 AM, oldk1331 wrote: > diff --git a/src/algebra/bezout.spad b/src/algebra/bezout.spad > index 16d3ed50..9f808600 100644 > --- a/src/algebra/bezout.spad > +++ b/src/algebra/bezout.spad > @@ -32,7 +32,7 @@ > Exports ==> with > sylvesterMatrix : (UP, UP) -> M > ++ sylvesterMatrix(p, q) returns the Sylvester matrix for the two > - ++ polynomials p and q. > + ++ nonzero polynomials p and q. > > subSylvesterMatrix : (M, NNI) -> M > ++ subSylvesterMatrix(S, j) returns the jth sub-Sylvester matrix > @@ -66,6 +66,7 @@ > Implementation ==> add > > sylvesterMatrix(p, q) == > + if p = 0 or q = 0 then error "sylvesterMatrix: argument is zero" > n1 := degree p; n2 := degree q; n := n1 + n2 > sylmat : M := new(n, n, 0) > minR := minRowIndex sylmat; minC := minColIndex sylmat > -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.
