Companion routine to dbnfac. it returns the solution x of the linear system a*x = b in place of b, given the lu-factorization for a in the work array w from dbnfac.
(with , as stored in w), the unit lower triangular system is solved for , and y stored in b. then the upper triangular system is solved for x. the calculations are so arranged that the innermost loops stay within columns.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(nroww,nrow) | :: | w |
describes the lu-factorization of a banded matrix a of
order |
|
integer(kind=ip), | intent(in) | :: | nroww |
describes the lu-factorization of a banded matrix a of order |
||
integer(kind=ip), | intent(in) | :: | nrow |
describes the lu-factorization of a banded matrix a of order |
||
integer(kind=ip), | intent(in) | :: | nbandl |
describes the lu-factorization of a banded matrix a of order |
||
integer(kind=ip), | intent(in) | :: | nbandu |
describes the lu-factorization of a banded matrix a of order |
||
real(kind=wp), | intent(inout), | dimension(nrow) | :: | b |
|
pure subroutine dbnslv(w,nroww,nrow,nbandl,nbandu,b) integer(ip),intent(in) :: nroww !! describes the lu-factorization of a banded matrix a of order `nrow` !! as constructed in [[dbnfac]]. integer(ip),intent(in) :: nrow !! describes the lu-factorization of a banded matrix a of order `nrow` !! as constructed in [[dbnfac]]. integer(ip),intent(in) :: nbandl !! describes the lu-factorization of a banded matrix a of order `nrow` !! as constructed in [[dbnfac]]. integer(ip),intent(in) :: nbandu !! describes the lu-factorization of a banded matrix a of order `nrow` !! as constructed in [[dbnfac]]. real(wp),dimension(nroww,nrow),intent(in) :: w !! describes the lu-factorization of a banded matrix a of !! order `nrow` as constructed in [[dbnfac]]. real(wp),dimension(nrow),intent(inout) :: b !! * **in**: right side of the system to be solved !! * **out**: the solution x, of order nrow integer(ip) :: i, j, jmax, middle, nrowm1 middle = nbandu + 1_ip if (nrow/=1_ip) then nrowm1 = nrow - 1_ip if (nbandl/=0_ip) then ! forward pass ! for i=1,2,...,nrow-1, subtract right side(i)*(i-th column of l) ! from right side (below i-th row). do i=1_ip,nrowm1 jmax = min(nbandl,nrow-i) do j=1_ip,jmax b(i+j) = b(i+j) - b(i)*w(middle+j,i) end do end do end if ! backward pass ! for i=nrow,nrow-1,...,1, divide right side(i) by i-th diagonal ! entry of u, then subtract right side(i)*(i-th column ! of u) from right side (above i-th row). if (nbandu<=0_ip) then ! a is lower triangular. do i=1_ip,nrow b(i) = b(i)/w(1_ip,i) end do return end if i = nrow do b(i) = b(i)/w(middle,i) jmax = min(nbandu,i-1_ip) do j=1_ip,jmax b(i-j) = b(i-j) - b(i)*w(middle-j,i) end do i = i - 1_ip if (i<=1_ip) exit end do end if b(1_ip) = b(1_ip)/w(middle,1_ip) end subroutine dbnslv