V3FIT
solver.f
1  SUBROUTINE solver(amat, b, m, nrhs, info)
2  USE stel_kinds
3  IMPLICIT NONE
4 C-----------------------------------------------
5 C D u m m y A r g u m e n t s
6 C-----------------------------------------------
7  INTEGER, INTENT(in) :: m, nrhs
8  INTEGER, INTENT(out) :: info
9  REAL(rprec), INTENT(inout) :: amat(m,m), b(m,nrhs)
10 C-----------------------------------------------
11 C L o c a l V a r i a b l e s
12 C-----------------------------------------------
13  INTEGER, ALLOCATABLE :: ipiv(:)
14 C-----------------------------------------------
15  info = 0
16  ALLOCATE (ipiv(m))
17 
18 ! Compute the solution to a REAL system of linear equations
19 ! AMAT * X = B,
20 ! WHERE AMAT is an M-by-M matrix and X and B are N-by-NRHS matrices.
21 !
22 ! FACTOR AMATRIX INTO LU FORM
23 ! AND SOLVE BY GAUSSIAN ELIMINATION
24 !
25  CALL dgesv (m, nrhs, amat, m, ipiv, b, m, info)
26 ! IF (info .ne. 0) PRINT *, ' Condition No. = 0 in Solver'
27 
28  DEALLOCATE (ipiv)
29 
30  END SUBROUTINE solver