Skip to content

fails of tests for QR and LQ decompositions #973

Description

@dklyuchinskiy

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

Activity

  1. dklyuchinskiy commented on Jan 12, 2024

    @dklyuchinskiy
    ContributorAuthor

    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.

  2. added a commit that references this issue on Jun 13, 2026
    063ccf0
  3. langou commented on Jul 13, 2026

    @langou
    Contributor

    Hi @dklyuchinskiy, let us know if #1298 fixes the issue. It should fix something. The difference between GEQRS (before #900) and GELS (after #900) is that GELS scales the matrix A so the QR factorization in output of GELS is scaled and this is not what CHKLQ expects, so what @jschueller in #1298 did is good and should help. Julien.

  4. dklyuchinskiy commented on Jul 13, 2026

    @dklyuchinskiy
    ContributorAuthor

    Hi @dklyuchinskiy, let us know if #1298 fixes the issue. It should fix something. The difference between GEQRS (before #900) and GELS (after #900) is that GELS scales the matrix A so the QR factorization in output of GELS is scaled and this is not what CHKLQ expects, so what @jschueller in #1298 did is good and should help. Julien.

    Hi, Julien!

    Unfortunately, at the moment I can not double check status of the issue, but looking into PR with proposed fixes I believe it should help. The problem was that QR factorization was being called in tests of LQ for specific configuration NB, M and N, but now it is fixed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions