lapack icon indicating copy to clipboard operation
lapack copied to clipboard

fails of tests for QR and LQ decompositions

Open dklyuchinskiy opened this issue 1 year ago • 1 comments

Hello!

I have been running tests for QR and LQ (xlintstd_dtest) and sometimes I have got failures like

M=   10, N=   10, K=    5, NB=   1, NX=    1, type  2, test( 1)= 0.16408E+16
M=   10, N=   10, K=    5, NB=   1, NX=    1, type  2, test( 2)= 0.62678E+15

Usually, I need to change input file to reproduce error.

My investigation shows, that root-cause is PR 900 with replacement GELQS by GELS (in example of LQ). Behavior of the test is changed a bit (see TESTING/LIN/dchklq.f):

Before: LQT01 is called to factorize matrix by GELQF for every combination of parameters m and n and this factorized matrix is used at any check of test parameter k.

Now: LQT01 is again called to factorize matrix, but later array AF is cleared to A to call GELS since factorization is now performed inside call of GELS. But, unfortunately, if m = n in call of GELS then factorization is done by GEQRF instead GELQF (check SRC/dgels.f). And this is a main difference. For upper triangular matrix QR factorization doing nothing, which lead to failure of test(1) and test(2) on the next iteration of parameter k, since arrays A and AF are equal.

@angsch please take a look.

Input is attached input qr and lq.txt

dklyuchinskiy avatar Jan 10 '24 08:01 dklyuchinskiy

Stable reproduced, if there is only one parameter NB in input file. That's why there are no fails for general input file.

It seems, root-cause is also clear. Test have 2 cycles

DO 40 IK = 1, NK
DO 30 INB = 1, NNB

If NNB >= 2, then factorized matrix becomes correct again, since factorization is performed by LQT01 (or GELQF) due to IK = 1. But if NNB = 1, then factorization is done by GELS, which calls GEQRF for m = n and test fails for next iterations of IK.

Actually, I still have no idea for proper solution to fix this behavior. Construction of the test is complicated. I believe, that we should somehow avoid call of QR in test for LQ.

dklyuchinskiy avatar Jan 12 '24 07:01 dklyuchinskiy