@@ -10,7 +10,8 @@ module m_eigen_solver
1010
1111 implicit none
1212
13- private ; public :: cg, cbal, corth, comqr2, csroot, cdiv, pythag
13+ private ;
14+ public :: cg, cbal, corth, comqr2, csroot, cdiv, pythag
1415
1516contains
1617
@@ -51,9 +52,14 @@ subroutine cg(nm, nl, ar, ai, wr, wi, zr, zi, fv1, fv2, fv3, ierr)
5152! this version dated august 1983.
5253!
5354! ------------------------------------------------------------------
54- integer nm, nl, is1, is2, ierr
55- real (kind (0d0 )), dimension (nm, nl) :: ar, ai, zr, zi
56- real (kind (0d0 )), dimension (nl) :: wr, wi, fv1, fv2, fv3
55+ integer , intent (in ) :: nm, nl
56+ real (kind (0d0 )), dimension (nm:nl), intent (inout ) :: ar, ai
57+ real (kind (0d0 )), dimension (nl), intent (out ) :: wr, wi
58+ real (kind (0d0 )), dimension (nm, nl), intent (out ) :: zr, zi
59+ real (kind (0d0 )), dimension (nl), intent (out ) :: fv1, fv2, fv3
60+ integer , intent (out ) :: ierr
61+
62+ integer :: is1, is2
5763
5864 if (nl <= nm) go to 10
5965 ierr = 10 * nl
@@ -125,11 +131,14 @@ subroutine cbal(nm, nl, ar, ai, low, igh, scale)
125131! this version dated august 1983.
126132!
127133! ------------------------------------------------------------------
128- integer i, j, k, l, ml, nl, jj, nm, igh, low, iexc
129- real (kind (0d0 )), dimension (nm, nl) :: ar, ai
130- real (kind (0d0 )), dimension (nl) :: scale
134+ integer , intent (in ) :: nm, nl
135+ real (kind (0d0 )), dimension (nm, nl), intent (inout ) :: ar, ai
136+ integer , intent (out ) :: low, igh
137+ real (kind (0d0 )), dimension (nl), intent (out ) :: scale
138+
139+ integer :: i, j, k, l, ml, jj, iexc
131140 real (kind (0d0 )) :: c, f, g, r, s, b2, radix
132- logical noconv
141+ logical :: noconv
133142
134143 radix = 16.0d0
135144
@@ -295,12 +304,13 @@ subroutine corth(nm, nl, low, igh, ar, ai, ortr, orti)
295304! this version dated august 1983.
296305!
297306! ------------------------------------------------------------------
298- integer i, j, ml, nl, ii, jj, la, mp, nm, igh, kp1, low
299- real (kind (0d0 )), dimension (nm, nl) :: ar, ai
300- real (kind (0d0 )), dimension (igh) :: ortr, orti
307+ integer , intent (in ) :: nm, nl, low, igh
308+ real (kind (0d0 )), dimension (nm, nl), intent (inout ) :: ar, ai
309+ real (kind (0d0 )), dimension (igh), intent (out ) :: ortr, orti
310+
311+ integer :: i, j, ml, ii, jj, la, mp, kp1, mll
301312 real (kind (0d0 )) :: f, g, h, fi, fr, scale, c
302313
303- integer mll
304314 mll = 6
305315
306316 la = igh - 1
@@ -460,11 +470,14 @@ subroutine comqr2(nm, nl, low, igh, ortr, orti, hr, hi, wr, wi, zr, zi, ierr)
460470! this version dated october 1989.
461471!
462472! ------------------------------------------------------------------
463- integer i, j, k, l, ml, nl, en, ii, jj, ll, nm, nn, igh, ip1, &
464- itn, its, low, lp1, enm1, iend, ierr
465- real (kind (0d0 )), dimension (nm, nl) :: hr, hi, zr, zi
466- real (kind (0d0 )), dimension (nl) :: wr, wi
467- real (kind (0d0 )), dimension (igh) :: ortr, orti
473+ integer , intent (in ) :: nm, nl, low, igh
474+ real (kind (0d0 )), dimension (nm, nl), intent (inout ) :: hr, hi
475+ real (kind (0d0 )), dimension (nl), intent (out ) :: wr, wi
476+ real (kind (0d0 )), dimension (nm, nl), intent (out ) :: zr, zi
477+ real (kind (0d0 )), dimension (igh), intent (inout ) :: ortr, orti
478+ integer , intent (out ) :: ierr
479+
480+ integer :: i, j, k, l, ml, en, ii, jj, ll, nn, ip1, itn, its, lp1, enm1, iend
468481 real (kind (0d0 )) :: si, sr, ti, tr, xi, xr, yi, yr, zzi, zzr, &
469482 norm, tst1, tst2, c, d
470483!
@@ -843,9 +856,13 @@ subroutine cbabk2(nm, nl, low, igh, scale, ml, zr, zi)
843856!
844857! ------------------------------------------------------------------
845858!
846- integer i, j, k, ml, nl, ii, nm, igh, low
847- double precision scale (nl), zr(nm, ml), zi(nm, ml)
848- double precision s
859+ integer , intent (in ) :: nm, nl, low, igh
860+ double precision , intent (in ) :: scale (nl)
861+ integer , intent (in ) :: ml
862+ double precision , intent (inout ) :: zr(nm, ml), zi(nm, ml)
863+
864+ integer :: i, j, k, ii
865+ double precision :: s
849866
850867 if (ml == 0 ) go to 200
851868 if (igh == low) go to 120
@@ -885,7 +902,8 @@ subroutine cbabk2(nm, nl, low, igh, scale, ml, zr, zi)
885902 end subroutine cbabk2
886903
887904 subroutine csroot (xr , xi , yr , yi )
888- real (kind (0d0 )) :: xr, xi, yr, yi
905+ real (kind (0d0 )), intent (in ) :: xr, xi
906+ real (kind (0d0 )), intent (out ) :: yr, yi
889907!
890908! (yr,yi) = complex dsqrt(xr,xi)
891909! branch chosen so that yr .ge. 0.0 and sign(yi) .eq. sign(xi)
@@ -904,7 +922,8 @@ subroutine csroot(xr, xi, yr, yi)
904922 end subroutine csroot
905923
906924 subroutine cdiv (ar , ai , br , bi , cr , ci )
907- real (kind (0d0 )) :: ar, ai, br, bi, cr, ci
925+ real (kind (0d0 )), intent (in ) :: ar, ai, br, bi
926+ real (kind (0d0 )), intent (out ) :: cr, ci
908927!
909928! complex division, (cr,ci) = (ar,ai)/(br,bi)
910929!
@@ -921,7 +940,8 @@ subroutine cdiv(ar, ai, br, bi, cr, ci)
921940 end subroutine cdiv
922941
923942 subroutine pythag (a , b , c )
924- real (kind (0d0 )) :: a, b, c
943+ real (kind (0d0 )), intent (in ) :: a, b
944+ real (kind (0d0 )), intent (out ) :: c
925945!
926946! finds dsqrt(a**2+b**2) without overflow or destructive underflow
927947!
0 commit comments