Igor Schein on Tue, 28 Feb 2006 20:22:53 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: qflllgram |
On Mon, Feb 27, 2006 at 05:14:24PM -0500, Gonzalo Tornaria wrote: > On Mon, Feb 27, 2006 at 12:58:22PM -0500, Igor Schein wrote: > > On Mon, Feb 27, 2006 at 01:34:11AM -0500, Gonzalo Tornaria wrote: > > > ? qflllgram([1,0;0,-1],0) > > > *** qflllgram: the PARI stack overflows ! > > > > I also have a question stemming from this behavior. Is the first > > argument a valid input? It's definitely symmetric, but does it > > correspond to a positive definite quadratic form, like the manual > > requires? > > It is certainly not definite, since it has a +1 and a -1 in the > diagonal (numbers in the diagonal are always represented). > > The point is that running qflllgram with an /integer/ indefinite > matrix uses a lot of memory (unbounded?) and it doesn't complete. If > you replace any of the diagonal entries by its corresponding floating > point number, the exception comes back immediately, and the same goes > if you use flag=1 (lllgramint). > > Best, Gonzalo So your primary concern here is that qflllgram() with default flag cannot detect/handle bad input. In current state of things many functions don't do a thorough check of its arguments, sometimes due to the fact that input validation is costlier than the actual computation, sometimes due to insufficient typing ( as in data types ). An abbreviation B(ad) I(input) B(ug) has been used for these bugs, and they occur much more frequently than genuine bugs. Users are encouraged to continue reporting them, unless Karim says otherwise :) I've proposed in the past expanding the number of isxxx() functions, because it's not always obvious ( at least not to an non-expert ) what constitutes valid input and what doesn't. In this case ( thanks for the tip, Bill ), a new library function ispositivedefiniteform() would probably be an overkill, however I believe the manual entry for qflllgram() and related functions should mention qfsign() as the way to validate input, e.g. ispositivedefiniteform(m)=mattranspose(m)==m&&qfsign(m)[1]==#m By the way, are matdet() and qfsign() equally expensive? Igor