solution of a system of linear equations with a dense symmetric
positive definite matrix a+e using the factorization a+e=l*d*trans(l)
obtained by the subroutine mxdpgf.
back substitution
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | n |
order of the matrix a. |
||
| real(kind=wp), | intent(in) | :: | a(*) |
|
||
| real(kind=wp), | intent(inout) | :: | x(*) |
x(n) on input the right hand side of a system of linear equations. on output the solution of a system of linear equations. |
||
| integer, | intent(in) | :: | job |
option
|
pure subroutine mxdpgb(n,a,x,job) integer,intent(in) :: job !! option !! !! * if `job=0` then `x:=(a+e)**(-1)*x`. !! * if `job>0` then `x:=l**(-1)*x`. !! * if `job<0` then `x:=trans(l)**(-1)*x`. integer,intent(in) :: n !! order of the matrix a. real(wp),intent(in) :: a(*) !! `a(n*(n+1)/2)` factorization `a+e=l*d*trans(l)` !! obtained by the subroutine [[mxdpgf]]. real(wp),intent(inout) :: x(*) !! x(n) on input the right hand side of a !! system of linear equations. on output the !! solution of a system of linear equations. integer :: i , ii , ij , j if ( job>=0 ) then ! phase 1 : x:=l**(-1)*x ij = 0 do i = 1 , n do j = 1 , i - 1 ij = ij + 1 x(i) = x(i) - a(ij)*x(j) end do ij = ij + 1 end do endif if ( job==0 ) then ! phase 2 : x:=d**(-1)*x ii = 0 do i = 1 , n ii = ii + i x(i) = x(i)/a(ii) end do endif if ( job<=0 ) then ! phase 3 : x:=trans(l)**(-1)*x ii = n*(n-1)/2 do i = n - 1 , 1 , -1 ij = ii do j = i + 1 , n ij = ij + j - 1 x(i) = x(i) - a(ij)*x(j) end do ii = ii - i end do endif end subroutine mxdpgb