Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=r64) | :: | a(10,10) | ||||
integer | :: | n | ||||
integer | :: | indx(10) | ||||
real(kind=r64) | :: | b(10) |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
SUBROUTINE LUsolution(a,n,indx,b)
! SUBROUTINE INFORMATION:
! AUTHOR F. Winkelmann, adapted from Numerical Recipes
! DATE WRITTEN February 2000
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Solves set of linear equations a.x = b
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! na
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
REAL(r64) :: a(10,10) ! Matrix and vector in a.x = b;
! b is also output as the solution, x
INTEGER :: n ! Dimension of a and b
INTEGER :: indx(10) ! Vector of row permutations
REAL(r64) :: b(10) ! Matrix and vector in a.x = b;
! b is also output as the solution, x
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: i,j ! Counters
INTEGER :: ii,ll ! Intermediate variables
REAL(r64) :: sum ! Summation variable
! FLOW
ii=0
do i=1,n
ll=indx(i)
sum=b(ll)
b(ll)=b(i)
if (ii.ne.0)then
do j=ii,i-1
sum=sum-a(i,j)*b(j)
end do
else if (sum.ne.0.0d0) then
ii=i
endif
b(i)=sum
end do
do i=n,1,-1
sum=b(i)
do j=i+1,n
sum=sum-a(i,j)*b(j)
end do
b(i)=sum/a(i,i)
end do
return
END SUBROUTINE LUsolution