lu6Ut Subroutine

private subroutine lu6Ut(inform, m, n, v, w, lena, luparm, parmlu, a, indr, p, q, lenr, locr)

Arguments

Type IntentOptional Attributes Name
integer(kind=ip), intent(out) :: inform
integer(kind=ip), intent(in) :: m
integer(kind=ip), intent(in) :: n
real(kind=rp), intent(out) :: v(m)
real(kind=rp), intent(inout) :: w(n)
integer(kind=ip), intent(in) :: lena
integer(kind=ip), intent(inout) :: luparm(30)
real(kind=rp), intent(inout) :: parmlu(30)
real(kind=rp), intent(in) :: a(lena)
integer(kind=ip), intent(in) :: indr(lena)
integer(kind=ip), intent(in) :: p(m)
integer(kind=ip), intent(in) :: q(n)
integer(kind=ip), intent(in) :: lenr(m)
integer(kind=ip), intent(in) :: locr(m)

Called by

proc~~lu6ut~~CalledByGraph proc~lu6ut lusol::lu6Ut proc~lu6sol lusol::lu6sol proc~lu6sol->proc~lu6ut proc~lu8rpc lusol::lu8rpc proc~lu8rpc->proc~lu6sol proc~solve lusol_ez_module::solve proc~solve->proc~lu6sol proc~test_1 main::test_1 proc~test_1->proc~solve proc~test_2 main::test_2 proc~test_2->proc~solve program~main~2 main program~main~2->proc~test_1 program~main~2->proc~test_2

Source Code

  subroutine lu6Ut ( inform, m, n, v, w, &
                     lena, luparm, parmlu, a, indr, p, q, lenr, locr )

    integer(ip),   intent(in)    :: m, n, lena
    integer(ip),   intent(in)    :: indr(lena), p(m), q(n), lenr(m), locr(m)
    real(rp),      intent(in)    :: a(lena)
    integer(ip),   intent(inout) :: luparm(30)
    real(rp),      intent(inout) :: parmlu(30), w(n)
    integer(ip),   intent(out)   :: inform
    real(rp),      intent(out)   :: v(m)

    !------------------------------------------------------------------
    ! lu6Ut  solves   U'v = w.          w  is destroyed.
    !
    ! 15 Dec 2002: First version derived from lu6sol.
    ! 15 Dec 2002: Current version.
    ! 13 Dec 2011: First f90 version.
    !------------------------------------------------------------------

    integer(ip)            :: i, j, k, l, l1, l2, nrank, nrank1
    real(rp)               :: resid, small, t


    nrank  = luparm(16)
    small  = parmlu(3)
    inform = 0
    nrank1 = nrank + 1
    resid  = zero

    do k = nrank1, m
       i     = p(k)
       v(i)  = zero
    end do

    ! Do the forward-substitution, skipping columns of U(transpose)
    ! when the associated element of w(*) is negligible.

    do k = 1, nrank
       i      = p(k)
       j      = q(k)
       t      = w(j)
       if (abs(t) <= small) then
          v(i) = zero
          cycle
       end if

       l1     = locr(i)
       t      = t/a(l1)
       v(i)   = t
       l2     = l1 + lenr(i) - 1
       l1     = l1 + 1

       !***** This loop could be coded specially.
       do l = l1, l2
          j    = indr(l)
          w(j) = w(j) - t*a(l)
       end do
    end do

    ! Compute residual for overdetermined systems.

    do k = nrank1, n
       j     = q(k)
       resid = resid + abs(w(j))
    end do

    ! Exit.

    if (resid > zero) inform = 1
    luparm(10) = inform
    parmlu(20) = resid

  end subroutine lu6Ut