Skip to content

Rank Updates Incorrect for Matrices that are Not Fullrank #9

Description

@Rioghasarig

When the matrix being factored was not full rank, it seemed the updates were not being fully applied.

It looks like the problem comes from the following code in the lu8mod function:

  120 if (nrank .lt. m) then
         nrank  = nrank + 1
         jelm   = 0
         call lu7elm( m, n, jelm, v,
     $                lena, luparm, parmlu,
     $                lenl, lenu, lrow, nrank,
     $                a, indc, indr, ip, iq, lenr, locc, locr,
     $                inform, diag )
         if (inform .eq. 7) go to 970
         if (inform .eq. 0) nrank = nrank - 1
      end if

I don't think nrank should be incremented before the call to lu7elm. lu7elm already increments nrank. Incrementing it beforehand causes nrank to be incremented twice which causes lu7elm to miss an element when performing the elimination.

I believe the problem can be fixed by changing the above code to

  120 if (nrank .lt. m) then
         jelm   = 0
         call lu7elm( m, n, jelm, v,
     $                lena, luparm, parmlu,
     $                lenl, lenu, lrow, nrank,
     $                a, indc, indr, ip, iq, lenr, locc, locr,
     $                inform, diag )
         if (inform .eq. 7) go to 970
         if (inform .eq. 1) nrank = nrank + 1
      end if 

So that nrank is updated after the call to lu7elm.

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions