Karim Belabas on Sat, 01 Jan 2022 20:01:54 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Error in qfauto() && Happy New Year |
* Georgi Guninski [2022-01-01 19:11]: > On Sat, Jan 1, 2022 at 5:36 PM Karim Belabas > <Karim.Belabas@math.u-bordeaux.fr> wrote: >> Bad Input Bug: M1 must be a positive definite quadratic form, but >> >> (16:33) gp > qfsign(M1) >> %1 = [7, 3] > > Looks like there is some protection against PD: > > ? M0=[1,0;0,0];qfauto(M0,M0) > *** at top-level: M0=[1,0;0,0];qfauto(M0,M0) > *** ^------------- > *** qfauto: domain error in qfisom: form is not positive definite > *** Break loop: type 'break' to go back to GP prompt This is not a foolproof protection (as your other example shows), only a trivial sanity check. When the matrix is only positive (but need not have maximal rank), the preliminary functions we use do finish correctly AND determine whether the form is positive definite, for free. When there is a negative eigenvalue, nothing is guaranteed and the preliminary function will usually fail... We *could* slow down slightly the function by always including a preliminary call to qfsign(), but we made a general PARI/GP design decision not to add sanity checks that do not come entirely for free, see http://pari.math.u-bordeaux.fr/faq.html#BIB Cheers, K.B. -- Karim Belabas, IMB (UMR 5251) Tel: (+33) (0)5 40 00 26 17 Universite de Bordeaux Fax: (+33) (0)5 40 00 21 23 351, cours de la Liberation http://www.math.u-bordeaux.fr/~kbelabas/ F-33405 Talence (France) http://pari.math.u-bordeaux.fr/ [PARI/GP] `