WAVEWATCH III  beta 0.0.1
w3profsmd.F90 File Reference

Go to the source code of this file.

Modules

module  w3profsmd
 

Functions/Subroutines

subroutine w3profsmd::w3xypug (ISP, FACX, FACY, DTG, VQ, VGX, VGY, LCALC)
 
subroutine w3profsmd::w3cflug (ISEA, NKCFL, FACX, FACY, DT, MAPFS, CFLXYMAX, VGX, VGY)
 
subroutine w3profsmd::w3xypfsn2 (ISP, C, LCALC, RD10, RD20, DT, AC)
 
subroutine w3profsmd::w3xypfspsi2 (ISP, C, LCALC, RD10, RD20, DT, AC)
 
subroutine w3profsmd::w3xypfsnimp (ISP, C, LCALC, RD10, RD20, DT, AC)
 
subroutine w3profsmd::w3xypfsfct2 (ISP, C, LCALC, RD10, RD20, DT, AC)
 
subroutine w3profsmd::setdepth
 
subroutine bcgstab (n, rhs, sol, ipar, fpar, w)
 
subroutine implu (np, umm, beta, ypiv, u, permut, full)
 
subroutine uppdir (n, p, np, lbp, indp, y, u, usav, flops)
 
subroutine givens (x, y, c, s)
 
logical function stopbis (n, ipar, mvpi, fpar, r, delx, sx)
 
subroutine tidycg (n, ipar, fpar, sol, delx)
 
logical function brkdn (alpha, ipar)
 
subroutine bisinit (ipar, fpar, wksize, dsc, lp, rp, wk)
 
subroutine mgsro (full, lda, n, m, ind, ops, vec, hh, ierr)
 
subroutine amux (n, x, y, a, ja, ia)
 
subroutine amuxms (n, x, y, a, ja)
 
subroutine atmux (n, x, y, a, ja, ia)
 
subroutine atmuxr (m, n, x, y, a, ja, ia)
 
subroutine amuxe (n, x, y, na, ncol, a, ja)
 
subroutine amuxd (n, x, y, diag, ndiag, idiag, ioff)
 
subroutine amuxj (n, x, y, jdiag, a, ja, ia)
 
subroutine vbrmv (nr, nc, ia, ja, ka, a, kvstr, kvstc, x, b)
 
subroutine lsol (n, x, y, al, jal, ial)
 
subroutine ldsol (n, x, y, al, jal)
 
subroutine lsolc (n, x, y, al, jal, ial)
 
subroutine ldsolc (n, x, y, al, jal)
 
subroutine ldsoll (n, x, y, al, jal, nlev, lev, ilev)
 
subroutine usol (n, x, y, au, jau, iau)
 
subroutine udsol (n, x, y, au, jau)
 
subroutine usolc (n, x, y, au, jau, iau)
 
subroutine udsolc (n, x, y, au, jau)
 
subroutine lusol (n, y, x, alu, jlu, ju)
 
subroutine lutsol (n, y, x, alu, jlu, ju)
 
subroutine qsplit (a, ind, n, ncut)
 
subroutine runrc (n, rhs, sol, ipar, fpar, wk, guess, a, ja, ia, au, jau, ju, solver)
 
subroutine ilut (n, a, ja, ia, lfil, droptol, alu, jlu, ju, iwk, w, jw, ierr)
 
subroutine ilu0 (n, a, ja, ia, alu, jlu, ju, iw, ierr)
 
subroutine pgmres (n, im, rhs, sol, eps, maxits, aspar, nnz, ia, ja, alu, jlu, ju, vv, ierr)
 
double precision function dnrm2 (N, X)
 
subroutine dlassq (N, X, SCALE, SUMSQ)
 
double precision function ddot (n, dx, dy)
 
subroutine daxpy (n, da, dx, incx, dy, incy)
 

Function/Subroutine Documentation

◆ amux()

subroutine amux ( integer  n,
real*8, dimension(*)  x,
real*8, dimension(*)  y,
real*8, dimension(*)  a,
integer, dimension(*)  ja,
integer, dimension(*)  ia 
)

Definition at line 2820 of file w3profsmd.F90.

2820  real*8 x(*), y(*), a(*)
2821  integer n, ja(*), ia(*)
2822  !-----------------------------------------------------------------------
2823  ! A times a vector
2824  !-----------------------------------------------------------------------
2825  ! multiplies a matrix by a vector using the dot product form
2826  ! Matrix A is stored in compressed sparse row storage.
2827  !
2828  ! on entry:
2829  !----------
2830  ! n = row dimension of A
2831  ! x = real array of length equal to the column dimension of
2832  ! the A matrix.
2833  ! a, ja,
2834  ! ia = input matrix in compressed sparse row format.
2835  !
2836  ! on return:
2837  !-----------
2838  ! y = real array of length n, containing the product y=Ax
2839  !
2840  !-----------------------------------------------------------------------
2841  ! local variables
2842  !
2843  real*8 t
2844  integer i, k
2845  !-----------------------------------------------------------------------
2846  do i = 1,n
2847  !
2848  ! compute the inner product of row i with vector x
2849  !
2850  t = 0.0d0
2851  do k=ia(i), ia(i+1)-1
2852  t = t + a(k)*x(ja(k))
2853  end do
2854  !
2855  ! store result in y(i)
2856  !
2857  y(i) = t
2858  end do
2859  !
2860  return
2861  !---------end-of-amux---------------------------------------------------
2862  !-----------------------------------------------------------------------

Referenced by pgmres(), and runrc().

◆ amuxd()

subroutine amuxd ( integer  n,
real*8, dimension(n)  x,
real*8, dimension(n)  y,
real*8, dimension(ndiag,idiag)  diag,
integer  ndiag,
integer  idiag,
integer, dimension(idiag)  ioff 
)

Definition at line 3055 of file w3profsmd.F90.

3055  integer n, ndiag, idiag, ioff(idiag)
3056  real*8 x(n), y(n), diag(ndiag,idiag)
3057  !-----------------------------------------------------------------------
3058  ! A times a vector in Diagonal storage format (DIA)
3059  !-----------------------------------------------------------------------
3060  ! multiplies a matrix by a vector when the original matrix is stored
3061  ! in the diagonal storage format.
3062  !-----------------------------------------------------------------------
3063  !
3064  ! on entry:
3065  !----------
3066  ! n = row dimension of A
3067  ! x = real array of length equal to the column dimension of
3068  ! the A matrix.
3069  ! ndiag = integer. The first dimension of array adiag as declared in
3070  ! the calling program.
3071  ! idiag = integer. The number of diagonals in the matrix.
3072  ! diag = real array containing the diagonals stored of A.
3073  ! idiag = number of diagonals in matrix.
3074  ! diag = real array of size (ndiag x idiag) containing the diagonals
3075  !
3076  ! ioff = integer array of length idiag, containing the offsets of the
3077  ! diagonals of the matrix:
3078  ! diag(i,k) contains the element a(i,i+ioff(k)) of the matrix.
3079  !
3080  ! on return:
3081  !-----------
3082  ! y = real array of length n, containing the product y=A*x
3083  !
3084  !-----------------------------------------------------------------------
3085  ! local variables
3086  !
3087  integer j, k, io, i1, i2
3088  !-----------------------------------------------------------------------
3089  do j=1, n
3090  y(j) = 0.0d0
3091  end do
3092  do j=1, idiag
3093  io = ioff(j)
3094  i1 = max0(1,1-io)
3095  i2 = min0(n,n-io)
3096  do k=i1, i2
3097  y(k) = y(k)+diag(k,j)*x(k+io)
3098  end do
3099  end do
3100  !
3101  return
3102  !----------end-of-amuxd-------------------------------------------------
3103  !-----------------------------------------------------------------------

◆ amuxe()

subroutine amuxe ( integer  n,
real*8, dimension(n)  x,
real*8, dimension(n)  y,
integer  na,
integer  ncol,
real*8, dimension(na,*)  a,
integer, dimension(na,*)  ja 
)

Definition at line 3006 of file w3profsmd.F90.

3006  implicit none
3007 
3008  integer :: n, na, ncol, ja(na,*)
3009  real*8 :: x(n), y(n), a(na,*)
3010 
3011  !-----------------------------------------------------------------------
3012  ! A times a vector in Ellpack Itpack format (ELL)
3013  !-----------------------------------------------------------------------
3014  ! multiplies a matrix by a vector when the original matrix is stored
3015  ! in the ellpack-itpack sparse format.
3016  !-----------------------------------------------------------------------
3017  !
3018  ! on entry:
3019  !----------
3020  ! n = row dimension of A
3021  ! x = real array of length equal to the column dimension of
3022  ! the A matrix.
3023  ! na = integer. The first dimension of arrays a and ja
3024  ! as declared by the calling program.
3025  ! ncol = integer. The number of active columns in array a.
3026  ! (i.e., the number of generalized diagonals in matrix.)
3027  ! a, ja = the real and integer arrays of the itpack format
3028  ! (a(i,k),k=1,ncol contains the elements of row i in matrix
3029  ! ja(i,k),k=1,ncol contains their column numbers)
3030  !
3031  ! on return:
3032  !-----------
3033  ! y = real array of length n, containing the product y=y=A*x
3034  !
3035  !-----------------------------------------------------------------------
3036  ! local variables
3037  !
3038  integer i, j
3039  !-----------------------------------------------------------------------
3040  do i=1, n
3041  y(i) = 0.0
3042  end do
3043  do j=1,ncol
3044  do i = 1,n
3045  y(i) = y(i)+a(i,j)*x(ja(i,j))
3046  end do
3047  end do
3048  !
3049  return
3050  !--------end-of-amuxe---------------------------------------------------
3051  !-----------------------------------------------------------------------

◆ amuxj()

subroutine amuxj ( integer  n,
real*8, dimension(n)  x,
real*8, dimension(n)  y,
integer  jdiag,
real*8, dimension(*)  a,
integer, dimension(*)  ja,
integer, dimension(*)  ia 
)

Definition at line 3107 of file w3profsmd.F90.

3107  integer n, jdiag, ja(*), ia(*)
3108  real*8 x(n), y(n), a(*)
3109  !-----------------------------------------------------------------------
3110  ! A times a vector in Jagged-Diagonal storage format (JAD)
3111  !-----------------------------------------------------------------------
3112  ! multiplies a matrix by a vector when the original matrix is stored
3113  ! in the jagged diagonal storage format.
3114  !-----------------------------------------------------------------------
3115  !
3116  ! on entry:
3117  !----------
3118  ! n = row dimension of A
3119  ! x = real array of length equal to the column dimension of
3120  ! the A matrix.
3121  ! jdiag = integer. The number of jadded-diagonals in the data-structure.
3122  ! a = real array containing the jadded diagonals of A stored
3123  ! in succession (in decreasing lengths)
3124  ! j = integer array containing the colum indices of the
3125  ! corresponding elements in a.
3126  ! ia = integer array containing the lengths of the jagged diagonals
3127  !
3128  ! on return:
3129  !-----------
3130  ! y = real array of length n, containing the product y=A*x
3131  !
3132  ! Note:
3133  !-------
3134  ! Permutation related to the JAD format is not performed.
3135  ! this can be done by:
3136  ! call permvec (n,y,y,iperm)
3137  ! after the call to amuxj, where iperm is the permutation produced
3138  ! by csrjad.
3139  !-----------------------------------------------------------------------
3140  ! local variables
3141  !
3142  integer i, ii, k1, ilen, j
3143  !-----------------------------------------------------------------------
3144  do i=1, n
3145  y(i) = 0.0d0
3146  end do
3147  do ii=1, jdiag
3148  k1 = ia(ii)-1
3149  ilen = ia(ii+1)-k1-1
3150  do j=1,ilen
3151  y(j)= y(j)+a(k1+j)*x(ja(k1+j))
3152  end do
3153  end do
3154  !
3155  return
3156  !----------end-of-amuxj-------------------------------------------------
3157  !-----------------------------------------------------------------------

◆ amuxms()

subroutine amuxms ( integer  n,
real*8, dimension(*)  x,
real*8, dimension(*)  y,
real*8, dimension(*)  a,
integer, dimension(*)  ja 
)

Definition at line 2866 of file w3profsmd.F90.

2866  real*8 x(*), y(*), a(*)
2867  integer n, ja(*)
2868  !-----------------------------------------------------------------------
2869  ! A times a vector in MSR format
2870  !-----------------------------------------------------------------------
2871  ! multiplies a matrix by a vector using the dot product form
2872  ! Matrix A is stored in Modified Sparse Row storage.
2873  !
2874  ! on entry:
2875  !----------
2876  ! n = row dimension of A
2877  ! x = real array of length equal to the column dimension of
2878  ! the A matrix.
2879  ! a, ja,= input matrix in modified compressed sparse row format.
2880  !
2881  ! on return:
2882  !-----------
2883  ! y = real array of length n, containing the product y=Ax
2884  !
2885  !-----------------------------------------------------------------------
2886  ! local variables
2887  !
2888  integer i, k
2889  !-----------------------------------------------------------------------
2890  do i=1, n
2891  y(i) = a(i)*x(i)
2892  end do
2893  do i = 1,n
2894  !
2895  ! compute the inner product of row i with vector x
2896  !
2897  do k=ja(i), ja(i+1)-1
2898  y(i) = y(i) + a(k) *x(ja(k))
2899  end do
2900  end do
2901  !
2902  return
2903  !---------end-of-amuxm--------------------------------------------------
2904  !-----------------------------------------------------------------------

◆ atmux()

subroutine atmux ( integer  n,
real*8, dimension(*)  x,
real*8, dimension(*)  y,
real*8, dimension(*)  a,
integer, dimension(*)  ja,
integer, dimension(*)  ia 
)

Definition at line 2908 of file w3profsmd.F90.

2908  real*8 x(*), y(*), a(*)
2909  integer n, ia(*), ja(*)
2910  !-----------------------------------------------------------------------
2911  ! transp( A ) times a vector
2912  !-----------------------------------------------------------------------
2913  ! multiplies the transpose of a matrix by a vector when the original
2914  ! matrix is stored in compressed sparse row storage. Can also be
2915  ! viewed as the product of a matrix by a vector when the original
2916  ! matrix is stored in the compressed sparse column format.
2917  !-----------------------------------------------------------------------
2918  !
2919  ! on entry:
2920  !----------
2921  ! n = row dimension of A
2922  ! x = real array of length equal to the column dimension of
2923  ! the A matrix.
2924  ! a, ja,
2925  ! ia = input matrix in compressed sparse row format.
2926  !
2927  ! on return:
2928  !-----------
2929  ! y = real array of length n, containing the product y=transp(A)*x
2930  !
2931  !-----------------------------------------------------------------------
2932  ! local variables
2933  !
2934  integer i, k
2935  !-----------------------------------------------------------------------
2936  !
2937  ! zero out output vector
2938  !
2939  do i=1,n
2940  y(i) = 0.0
2941  end do
2942  !
2943  ! loop over the rows
2944  !
2945  do i = 1,n
2946  do k=ia(i), ia(i+1)-1
2947  y(ja(k)) = y(ja(k)) + x(i)*a(k)
2948  end do
2949  end do
2950  !
2951  return
2952  !-------------end-of-atmux----------------------------------------------
2953  !-----------------------------------------------------------------------

Referenced by runrc().

◆ atmuxr()

subroutine atmuxr ( integer  m,
integer  n,
real*8, dimension(*)  x,
real*8, dimension(*)  y,
real*8, dimension(*)  a,
integer, dimension(*)  ja,
integer, dimension(*)  ia 
)

Definition at line 2957 of file w3profsmd.F90.

2957  real*8 x(*), y(*), a(*)
2958  integer m, n, ia(*), ja(*)
2959  !-----------------------------------------------------------------------
2960  ! transp( A ) times a vector, A can be rectangular
2961  !-----------------------------------------------------------------------
2962  ! See also atmux. The essential difference is how the solution vector
2963  ! is initially zeroed. If using this to multiply rectangular CSC
2964  ! matrices by a vector, m number of rows, n is number of columns.
2965  !-----------------------------------------------------------------------
2966  !
2967  ! on entry:
2968  !----------
2969  ! m = column dimension of A
2970  ! n = row dimension of A
2971  ! x = real array of length equal to the column dimension of
2972  ! the A matrix.
2973  ! a, ja,
2974  ! ia = input matrix in compressed sparse row format.
2975  !
2976  ! on return:
2977  !-----------
2978  ! y = real array of length n, containing the product y=transp(A)*x
2979  !
2980  !-----------------------------------------------------------------------
2981  ! local variables
2982  !
2983  integer i, k
2984  !-----------------------------------------------------------------------
2985  !
2986  ! zero out output vector
2987  !
2988  do i=1,m
2989  y(i) = 0.0
2990  end do
2991  !
2992  ! loop over the rows
2993  !
2994  do i = 1,n
2995  do k=ia(i), ia(i+1)-1
2996  y(ja(k)) = y(ja(k)) + x(i)*a(k)
2997  end do
2998  end do
2999  !
3000  return
3001  !-------------end-of-atmuxr---------------------------------------------
3002  !-----------------------------------------------------------------------

◆ bcgstab()

subroutine bcgstab ( integer  n,
real*8, dimension(n)  rhs,
real*8, dimension(n)  sol,
integer, dimension(16)  ipar,
real*8, dimension(16)  fpar,
real*8, dimension(n,8)  w 
)

Definition at line 2044 of file w3profsmd.F90.

2044  implicit none
2045  integer n, ipar(16)
2046  real*8 rhs(n), sol(n), fpar(16), w(n,8)
2047  !-----------------------------------------------------------------------
2048  ! BCGSTAB --- Bi Conjugate Gradient stabilized (BCGSTAB)
2049  ! This is an improved BCG routine. (1) no matrix transpose is
2050  ! involved. (2) the convergence is smoother.
2051  !
2052  !
2053  ! Algorithm:
2054  ! Initialization - r = b - A x, r0 = r, p = r, rho = (r0, r),
2055  ! Iterate -
2056  ! (1) v = A p
2057  ! (2) alpha = rho / (r0, v)
2058  ! (3) s = r - alpha v
2059  ! (4) t = A s
2060  ! (5) omega = (t, s) / (t, t)
2061  ! (6) x = x + alpha * p + omega * s
2062  ! (7) r = s - omega * t
2063  ! convergence test goes here
2064  ! (8) beta = rho, rho = (r0, r), beta = rho * alpha / (beta * omega)
2065  ! p = r + beta * (p - omega * v)
2066  !
2067  ! in this routine, before successful return, the fpar's are
2068  ! fpar(3) == initial (preconditionied-)residual norm
2069  ! fpar(4) == target (preconditionied-)residual norm
2070  ! fpar(5) == current (preconditionied-)residual norm
2071  ! fpar(6) == current residual norm or error
2072  ! fpar(7) == current rho (rhok = <r, r0>)
2073  ! fpar(8) == alpha
2074  ! fpar(9) == omega
2075  !
2076  ! Usage of the work space W
2077  ! w(:, 1) = r0, the initial residual vector
2078  ! w(:, 2) = r, current residual vector
2079  ! w(:, 3) = s
2080  ! w(:, 4) = t
2081  ! w(:, 5) = v
2082  ! w(:, 6) = p
2083  ! w(:, 7) = tmp, used in preconditioning, etc.
2084  ! w(:, 8) = delta x, the correction to the answer is accumulated
2085  ! here, so that the right-preconditioning may be applied
2086  ! at the end
2087  !-----------------------------------------------------------------------
2088  ! external routines used
2089  !
2090  real*8 ddot
2091  logical stopbis, brkdn
2092  external ddot, stopbis, brkdn
2093  !
2094  real*8 one
2095  parameter(one=1.0d0)
2096  !
2097  ! local variables
2098  !
2099  integer i
2100  real*8 alpha,beta,rho,omega
2101  logical lp, rp
2102  save lp, rp
2103  !
2104  ! where to go
2105  !
2106  if (ipar(1).gt.0) then
2107  !!goto (10, 20, 40, 50, 60, 70, 80, 90, 100, 110) ipar(10)
2108  SELECT CASE (ipar(10))
2109  CASE (1)
2110  GOTO 10
2111  CASE (2)
2112  GOTO 20
2113  CASE (3)
2114  GOTO 40
2115  CASE (4)
2116  GOTO 50
2117  CASE (5)
2118  GOTO 60
2119  CASE (6)
2120  GOTO 70
2121  CASE (7)
2122  GOTO 80
2123  CASE (8)
2124  GOTO 90
2125  CASE (9)
2126  GOTO 100
2127  CASE (10)
2128  GOTO 110
2129  END SELECT
2130  else if (ipar(1).lt.0) then
2131  goto 900
2132  endif
2133  !
2134  ! call the initialization routine
2135  !
2136  call bisinit(ipar,fpar,8*n,1,lp,rp,w)
2137  if (ipar(1).lt.0) return
2138  !
2139  ! perform a matvec to compute the initial residual
2140  !
2141  ipar(1) = 1
2142  ipar(8) = 1
2143  ipar(9) = 1 + n
2144  do i = 1, n
2145  w(i,1) = sol(i)
2146  enddo
2147  ipar(10) = 1
2148  return
2149 10 ipar(7) = ipar(7) + 1
2150  ipar(13) = ipar(13) + 1
2151  do i = 1, n
2152  w(i,1) = rhs(i) - w(i,2)
2153  enddo
2154  fpar(11) = fpar(11) + n
2155  if (lp) then
2156  ipar(1) = 3
2157  ipar(10) = 2
2158  return
2159  endif
2160  !
2161 20 if (lp) then
2162  do i = 1, n
2163  w(i,1) = w(i,2)
2164  w(i,6) = w(i,2)
2165  enddo
2166  else
2167  do i = 1, n
2168  w(i,2) = w(i,1)
2169  w(i,6) = w(i,1)
2170  enddo
2171  endif
2172  !
2173  fpar(7) = ddot(n,w,w)
2174  fpar(11) = fpar(11) + 2 * n
2175  fpar(5) = sqrt(fpar(7))
2176  fpar(3) = fpar(5)
2177  if (abs(ipar(3)).eq.2) then
2178  fpar(4) = fpar(1) * sqrt(ddot(n,rhs,rhs)) + fpar(2)
2179  fpar(11) = fpar(11) + 2 * n
2180  else if (ipar(3).ne.999) then
2181  fpar(4) = fpar(1) * fpar(3) + fpar(2)
2182  endif
2183  if (ipar(3).ge.0) fpar(6) = fpar(5)
2184  if (ipar(3).ge.0 .and. fpar(5).le.fpar(4) .and. ipar(3).ne.999) then
2185  goto 900
2186  endif
2187  !
2188  ! beginning of the iterations
2189  !
2190  ! Step (1), v = A p
2191 30 if (rp) then
2192  ipar(1) = 5
2193  ipar(8) = 5*n+1
2194  if (lp) then
2195  ipar(9) = 4*n + 1
2196  else
2197  ipar(9) = 6*n + 1
2198  endif
2199  ipar(10) = 3
2200  return
2201  endif
2202  !
2203 40 ipar(1) = 1
2204  if (rp) then
2205  ipar(8) = ipar(9)
2206  else
2207  ipar(8) = 5*n+1
2208  endif
2209  if (lp) then
2210  ipar(9) = 6*n + 1
2211  else
2212  ipar(9) = 4*n + 1
2213  endif
2214  ipar(10) = 4
2215  return
2216 50 if (lp) then
2217  ipar(1) = 3
2218  ipar(8) = ipar(9)
2219  ipar(9) = 4*n + 1
2220  ipar(10) = 5
2221  return
2222  endif
2223  !
2224 60 ipar(7) = ipar(7) + 1
2225  !
2226  ! step (2)
2227  alpha = ddot(n,w(1,1),w(1,5))
2228  fpar(11) = fpar(11) + 2 * n
2229  if (brkdn(alpha, ipar)) goto 900
2230  alpha = fpar(7) / alpha
2231  fpar(8) = alpha
2232  !
2233  ! step (3)
2234  do i = 1, n
2235  w(i,3) = w(i,2) - alpha * w(i,5)
2236  enddo
2237  fpar(11) = fpar(11) + 2 * n
2238  !
2239  ! Step (4): the second matvec -- t = A s
2240  !
2241  if (rp) then
2242  ipar(1) = 5
2243  ipar(8) = n+n+1
2244  if (lp) then
2245  ipar(9) = ipar(8)+n
2246  else
2247  ipar(9) = 6*n + 1
2248  endif
2249  ipar(10) = 6
2250  return
2251  endif
2252  !
2253 70 ipar(1) = 1
2254  if (rp) then
2255  ipar(8) = ipar(9)
2256  else
2257  ipar(8) = n+n+1
2258  endif
2259  if (lp) then
2260  ipar(9) = 6*n + 1
2261  else
2262  ipar(9) = 3*n + 1
2263  endif
2264  ipar(10) = 7
2265  return
2266 80 if (lp) then
2267  ipar(1) = 3
2268  ipar(8) = ipar(9)
2269  ipar(9) = 3*n + 1
2270  ipar(10) = 8
2271  return
2272  endif
2273 90 ipar(7) = ipar(7) + 1
2274  !
2275  ! step (5)
2276  omega = ddot(n,w(1,4),w(1,4))
2277  fpar(11) = fpar(11) + n + n
2278  if (brkdn(omega,ipar)) goto 900
2279  omega = ddot(n,w(1,4),w(1,3)) / omega
2280  fpar(11) = fpar(11) + n + n
2281  if (brkdn(omega,ipar)) goto 900
2282  fpar(9) = omega
2283  alpha = fpar(8)
2284  !
2285  ! step (6) and (7)
2286  do i = 1, n
2287  w(i,7) = alpha * w(i,6) + omega * w(i,3)
2288  w(i,8) = w(i,8) + w(i,7)
2289  w(i,2) = w(i,3) - omega * w(i,4)
2290  enddo
2291  fpar(11) = fpar(11) + 6 * n + 1
2292  !
2293  ! convergence test
2294  if (ipar(3).eq.999) then
2295  ipar(1) = 10
2296  ipar(8) = 7*n + 1
2297  ipar(9) = 6*n + 1
2298  ipar(10) = 9
2299  return
2300  endif
2301  if (stopbis(n,ipar,2,fpar,w(1,2),w(1,7),one)) goto 900
2302 100 if (ipar(3).eq.999.and.ipar(11).eq.1) goto 900
2303  !
2304  ! step (8): computing new p and rho
2305  !
2306  rho = fpar(7)
2307  fpar(7) = ddot(n,w(1,2),w(1,1))
2308  omega = fpar(9)
2309  beta = fpar(7) * fpar(8) / (fpar(9) * rho)
2310  do i = 1, n
2311  w(i,6) = w(i,2) + beta * (w(i,6) - omega * w(i,5))
2312  enddo
2313  fpar(11) = fpar(11) + 6 * n + 3
2314  if (brkdn(fpar(7),ipar)) goto 900
2315  !
2316  ! end of an iteration
2317  !
2318  goto 30
2319  !
2320  ! some clean up job to do
2321  !
2322 900 if (rp) then
2323  if (ipar(1).lt.0) ipar(12) = ipar(1)
2324  ipar(1) = 5
2325  ipar(8) = 7*n + 1
2326  ipar(9) = ipar(8) - n
2327  ipar(10) = 10
2328  return
2329  endif
2330 
2331 110 if (rp) then
2332  call tidycg(n,ipar,fpar,sol,w(1,7))
2333  else
2334  call tidycg(n,ipar,fpar,sol,w(1,8))
2335  endif
2336  !
2337  return
2338  !-----end-of-bcgstab

References bisinit(), brkdn(), ddot(), stopbis(), and tidycg().

Referenced by w3profsmd::w3xypfsnimp().

◆ bisinit()

subroutine bisinit ( integer, dimension(16)  ipar,
real*8, dimension(16)  fpar,
integer  wksize,
integer  dsc,
logical  lp,
logical  rp,
real*8, dimension(*)  wk 
)

Definition at line 2593 of file w3profsmd.F90.

2593  implicit none
2594  integer i,ipar(16),wksize,dsc
2595  logical lp,rp
2596  real*8 fpar(16),wk(*)
2597  !-----------------------------------------------------------------------
2598  ! some common initializations for the iterative solvers
2599  !-----------------------------------------------------------------------
2600  real*8 zero, one
2601  parameter(zero=0.0d0, one=1.0d0)
2602  !
2603  ! ipar(1) = -2 inidcate that there are not enough space in the work
2604  ! array
2605  !
2606  if (ipar(4).lt.wksize) then
2607  ipar(1) = -2
2608  ipar(4) = wksize
2609  return
2610  endif
2611  !
2612  if (ipar(2).gt.2) then
2613  lp = .true.
2614  rp = .true.
2615  else if (ipar(2).eq.2) then
2616  lp = .false.
2617  rp = .true.
2618  else if (ipar(2).eq.1) then
2619  lp = .true.
2620  rp = .false.
2621  else
2622  lp = .false.
2623  rp = .false.
2624  endif
2625  if (ipar(3).eq.0) ipar(3) = dsc
2626  ! .. clear the ipar elements used
2627  ipar(7) = 0
2628  ipar(8) = 0
2629  ipar(9) = 0
2630  ipar(10) = 0
2631  ipar(11) = 0
2632  ipar(12) = 0
2633  ipar(13) = 0
2634  !
2635  ! fpar(1) must be between (0, 1), fpar(2) must be positive,
2636  ! fpar(1) and fpar(2) can NOT both be zero
2637  ! Normally return ipar(1) = -4 to indicate any of above error
2638  !
2639  if (fpar(1).lt.zero .or. fpar(1).ge.one .or. fpar(2).lt.zero .or. &
2640  & (fpar(1).eq.zero .and. fpar(2).eq.zero)) then
2641  if (ipar(1).eq.0) then
2642  ipar(1) = -4
2643  return
2644  else
2645  fpar(1) = 1.0d-6
2646  fpar(2) = 1.0d-16
2647  endif
2648  endif
2649  ! .. clear the fpar elements
2650  do i = 3, 10
2651  fpar(i) = zero
2652  enddo
2653  if (fpar(11).lt.zero) fpar(11) = zero
2654  ! .. clear the used portion of the work array to zero
2655  do i = 1, wksize
2656  wk(i) = zero
2657  enddo
2658  !
2659  return
2660  !-----end-of-bisinit

Referenced by bcgstab().

◆ brkdn()

logical function brkdn ( real*8  alpha,
integer, dimension(16)  ipar 
)

Definition at line 2557 of file w3profsmd.F90.

2557  implicit none
2558  integer ipar(16)
2559  real*8 alpha, beta, zero, one
2560  parameter(zero=0.0d0, one=1.0d0)
2561  !-----------------------------------------------------------------------
2562  ! test whether alpha is zero or an abnormal number, if yes,
2563  ! this routine will return .true.
2564  !
2565  ! If alpha == 0, ipar(1) = -3,
2566  ! if alpha is an abnormal number, ipar(1) = -9.
2567  !-----------------------------------------------------------------------
2568  brkdn = .false.
2569  if (alpha.gt.zero) then
2570  beta = one / alpha
2571  if (.not. beta.gt.zero) then
2572  brkdn = .true.
2573  ipar(1) = -9
2574  endif
2575  else if (alpha.lt.zero) then
2576  beta = one / alpha
2577  if (.not. beta.lt.zero) then
2578  brkdn = .true.
2579  ipar(1) = -9
2580  endif
2581  else if (alpha.eq.zero) then
2582  brkdn = .true.
2583  ipar(1) = -3
2584  else
2585  brkdn = .true.
2586  ipar(1) = -9
2587  endif
2588  return

Referenced by bcgstab().

◆ daxpy()

subroutine daxpy ( integer  n,
double precision  da,
double precision, dimension(1)  dx,
integer  incx,
double precision, dimension(1)  dy,
integer  incy 
)

Definition at line 4641 of file w3profsmd.F90.

4641  !
4642  ! constant times a vector plus a vector.
4643  ! uses unrolled loops for increments equal to one.
4644  ! jack dongarra, linpack, 3/11/78.
4645  !
4646  double precision dx(1),dy(1),da
4647  integer i,incx,incy,ix,iy,m,mp1,n
4648  !
4649  if(n.le.0)return
4650  if (abs(da) .lt. tiny(1.d0)) return
4651  if(incx.eq.1.and.incy.eq.1)go to 20
4652  !
4653  ! code for unequal increments or equal increments
4654  ! not equal to 1
4655  !
4656  ix = 1
4657  iy = 1
4658  if(incx.lt.0)ix = (-n+1)*incx + 1
4659  if(incy.lt.0)iy = (-n+1)*incy + 1
4660  do i = 1,n
4661  dy(iy) = dy(iy) + da*dx(ix)
4662  ix = ix + incx
4663  iy = iy + incy
4664  end do
4665  return
4666  !
4667  ! code for both increments equal to 1
4668  !
4669  !
4670  ! clean-up loop
4671  !
4672 20 m = mod(n,4)
4673  if( m .eq. 0 ) go to 40
4674  do i = 1,m
4675  dy(i) = dy(i) + da*dx(i)
4676  end do
4677  if( n .lt. 4 ) return
4678 40 mp1 = m + 1
4679  do i = mp1,n,4
4680  dy(i) = dy(i) + da*dx(i)
4681  dy(i + 1) = dy(i + 1) + da*dx(i + 1)
4682  dy(i + 2) = dy(i + 2) + da*dx(i + 2)
4683  dy(i + 3) = dy(i + 3) + da*dx(i + 3)
4684  end do
4685  return

Referenced by pgmres().

◆ ddot()

double precision function ddot ( integer  n,
double precision, dimension(*)  dx,
double precision, dimension(*)  dy 
)

Definition at line 4613 of file w3profsmd.F90.

4613  !
4614  ! forms the dot product of two vectors.
4615  ! uses unrolled loops for increments equal to one.
4616  ! jack dongarra, linpack, 3/11/78.
4617  !
4618  double precision dx(*),dy(*),dtemp
4619  integer i,m,mp1,n
4620  !
4621  ddot = 0.0d0
4622  dtemp = 0.0d0
4623  if(n.le.0)return
4624 
4625 20 m = mod(n,5)
4626  if( m .eq. 0 ) go to 40
4627  do i = 1,m
4628  dtemp = dtemp + dx(i)*dy(i)
4629  end do
4630  if( n .lt. 5 ) go to 60
4631 40 mp1 = m + 1
4632  do i = mp1,n,5
4633  dtemp = dtemp + dx(i)*dy(i) + dx(i + 1)*dy(i + 1) + &
4634  & dx(i + 2)*dy(i + 2) + dx(i + 3)*dy(i + 3) + dx(i + 4)*dy(i + 4)
4635  end do
4636 60 ddot = dtemp
4637  return

Referenced by bcgstab(), mgsro(), pgmres(), and stopbis().

◆ dlassq()

subroutine dlassq ( integer  N,
double precision, dimension( * )  X,
double precision  SCALE,
double precision  SUMSQ 
)

Definition at line 4568 of file w3profsmd.F90.

4568  !
4569  ! -- LAPACK auxiliary routine (version 3.1) --
4570  ! Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
4571  ! November 2006
4572  INTEGER N
4573  DOUBLE PRECISION SCALE, SUMSQ
4574  DOUBLE PRECISION X( * )
4575  !
4576  ! DLASSQ returns the values scl and smsq such that
4577  !
4578  ! ( scl**2 )*smsq = x( 1 )**2 +...+ x( n )**2 + ( scale**2 )*sumsq,
4579  !
4580  ! where x( i ) = X( 1 + ( i - 1 )*INCX ). The value of sumsq is
4581  ! assumed to be non-negative and scl returns the value
4582  !
4583  ! scl = max( scale, abs( x( i ) ) ).
4584  !
4585  ! SCALE (input/output) DOUBLE PRECISION
4586  ! On entry, the value scale in the equation above.
4587  ! On exit, SCALE is overwritten with scl , the scaling factor
4588  ! for the sum of squares.
4589  DOUBLE PRECISION ZERO
4590  parameter( zero = 0.0d+0 )
4591  INTEGER IX
4592  DOUBLE PRECISION ABSXI
4593  INTRINSIC abs
4594  !
4595  IF( n.GT.0 ) THEN
4596  DO ix = 1, 1 + ( n-1 )
4597  IF( x( ix ).NE.zero ) THEN
4598  absxi = abs( x( ix ) )
4599  IF( scale.LT.absxi ) THEN
4600  sumsq = 1 + sumsq*( scale / absxi )**2
4601  scale = absxi
4602  ELSE
4603  sumsq = sumsq + ( absxi / scale )**2
4604  END IF
4605  END IF
4606  END DO
4607  END IF
4608  RETURN

◆ dnrm2()

double precision function dnrm2 ( integer  N,
double precision, dimension(*)  X 
)

Definition at line 4499 of file w3profsmd.F90.

4499  ! .. Scalar Arguments ..
4500  INTEGER N
4501  ! ..
4502  ! .. Array Arguments ..
4503  DOUBLE PRECISION X(*)
4504  ! ..
4505  !
4506  ! Purpose
4507  ! =======
4508  !
4509  ! DNRM2 returns the euclidean norm of a vector via the function
4510  ! name, so that
4511  !
4512  ! DNRM2 := sqrt( x'*x )
4513  !
4514  ! Further Details
4515  ! ===============
4516  !
4517  ! -- This version written on 25-October-1982.
4518  ! Modified on 14-October-1993 to inline the call to DLASSQ.
4519  ! Sven Hammarling, Nag Ltd.
4520  !
4521  ! =====================================================================
4522  !
4523  ! .. Parameters ..
4524  DOUBLE PRECISION ONE,ZERO
4525  parameter(one=1.0d+0,zero=0.0d+0)
4526  ! ..
4527  ! .. Local Scalars ..
4528  DOUBLE PRECISION ABSXI,NORM,SCALE,SSQ
4529  INTEGER IX
4530  ! ..
4531  ! .. Intrinsic Functions ..
4532  INTRINSIC abs,sqrt
4533  ! ..
4534  IF (n.LT.1 ) THEN
4535  norm = zero
4536  ELSE IF (n.EQ.1) THEN
4537  norm = abs(x(1))
4538  ELSE
4539  scale = zero
4540  ssq = one
4541  ! The following loop is equivalent to this call to the LAPACK
4542  ! auxiliary routine:
4543  ! CALL DLASSQ( N, X, SCALE, SSQ )
4544  !
4545  DO ix = 1,1 + (n-1)
4546  IF (x(ix).NE.zero) THEN
4547  absxi = abs(x(ix))
4548  IF (scale.LT.absxi) THEN
4549  ssq = one + ssq* (scale/absxi)**2
4550  scale = absxi
4551  ELSE
4552  ssq = ssq + (absxi/scale)**2
4553  END IF
4554  END IF
4555  end do
4556  norm = scale*sqrt(ssq)
4557  END IF
4558  !
4559  dnrm2 = norm
4560  RETURN
4561  !
4562  ! End of DNRM2.
4563  !

Referenced by pgmres().

◆ givens()

subroutine givens ( real*8  x,
real*8  y,
real*8  c,
real*8  s 
)

Definition at line 2423 of file w3profsmd.F90.

2423  implicit none
2424 
2425  real*8 :: x,y,c,s
2426  !-----------------------------------------------------------------------
2427  ! Given x and y, this subroutine generates a Givens' rotation c, s.
2428  ! And apply the rotation on (x,y) ==> (sqrt(x**2 + y**2), 0).
2429  ! (See P 202 of "matrix computation" by Golub and van Loan.)
2430  !-----------------------------------------------------------------------
2431  real*8 :: t,one,zero
2432  parameter(zero=0.0d0,one=1.0d0)
2433  !
2434  if (x.eq.zero .and. y.eq.zero) then
2435  c = one
2436  s = zero
2437  else if (abs(y).gt.abs(x)) then
2438  t = x / y
2439  x = sqrt(one+t*t)
2440  s = sign(one / x, y)
2441  c = t*s
2442  else if (abs(y).le.abs(x)) then
2443  t = y / x
2444  y = sqrt(one+t*t)
2445  c = sign(one / y, x)
2446  s = t*c
2447  else
2448  !
2449  ! X or Y must be an invalid floating-point number, set both to zero
2450  !
2451  x = zero
2452  y = zero
2453  c = one
2454  s = zero
2455  endif
2456  x = abs(x*y)
2457  !
2458  ! end of givens
2459  !
2460  return

◆ ilu0()

subroutine ilu0 ( integer  n,
real*8, dimension(*)  a,
integer, dimension(*)  ja,
integer, dimension(*)  ia,
real*8, dimension(*)  alu,
integer, dimension(*)  jlu,
integer, dimension(*)  ju,
integer, dimension(n)  iw,
integer  ierr 
)

Definition at line 4177 of file w3profsmd.F90.

4177 
4178  !implicit real*8 (a-h,o-z)
4179  real*8 a(*), alu(*), tl
4180  integer n, ju0, ii, jj, i, j, jcol, js, jf, jm, jrow, jw, ierr
4181  integer ja(*), ia(*), ju(*), jlu(*), iw(n)
4182  !
4183  !-----------------------------------------------------------------------
4184  ju0 = n+2
4185  jlu(1) = ju0 !!!
4186  iw = 0
4187  do ii = 1, n
4188  js = ju0
4189  do j=ia(ii),ia(ii+1)-1
4190  jcol = ja(j)
4191  if (jcol .eq. ii) then
4192  alu(ii) = a(j)
4193  iw(jcol) = ii
4194  ju(ii) = ju0 !!!
4195  else
4196  alu(ju0) = a(j)
4197  jlu(ju0) = ja(j)
4198  iw(jcol) = ju0
4199  ju0 = ju0+1
4200  endif
4201  end do
4202  jlu(ii+1) = ju0 !!!
4203  jf = ju0-1
4204  jm = ju(ii)-1
4205  ! exit if diagonal element is reached.
4206  do j=js, jm
4207  jrow = jlu(j)
4208  tl = alu(j)*alu(jrow)
4209  alu(j) = tl
4210  ! perform linear combination
4211  do jj = ju(jrow), jlu(jrow+1)-1
4212  jw = iw(jlu(jj))
4213  if (jw .ne. 0) then
4214  alu(jw) = alu(jw) - tl*alu(jj)
4215  ! write(*,*) ii, jw, jj
4216  end if
4217  end do
4218  end do
4219  ! invert and store diagonal element.
4220  if (abs(alu(ii)) .lt. tiny(1.)) goto 600
4221  alu(ii) = 1.0d0/alu(ii)
4222  ! reset pointer iw to zero
4223  iw(ii) = 0
4224  do i = js, jf
4225  iw(jlu(i)) = 0
4226  end do
4227  end do
4228 
4229  ierr = 0
4230  return
4231 
4232  ! zero pivot :
4233 600 ierr = ii
4234  return

Referenced by w3profsmd::w3xypfsnimp().

◆ ilut()

subroutine ilut ( integer  n,
real*8, dimension(*)  a,
integer, dimension(*)  ja,
integer, dimension(n+1)  ia,
integer  lfil,
real*8  droptol,
real*8, dimension(*)  alu,
integer, dimension(*)  jlu,
integer, dimension(n)  ju,
integer  iwk,
real*8, dimension(n+1)  w,
integer, dimension(2*n)  jw,
integer  ierr 
)

Definition at line 3827 of file w3profsmd.F90.

3827  !-----------------------------------------------------------------------
3828  implicit none
3829  integer n
3830  real*8 a(*),alu(*),w(n+1),droptol
3831  integer ja(*),ia(n+1),jlu(*),ju(n),jw(2*n),lfil,iwk,ierr
3832  !----------------------------------------------------------------------*
3833  ! *** ILUT preconditioner *** *
3834  ! incomplete LU factorization with dual truncation mechanism *
3835  !----------------------------------------------------------------------*
3836  ! Author: Yousef Saad *May, 5, 1990, Latest revision, August 1996 *
3837  !----------------------------------------------------------------------*
3838  ! PARAMETERS
3839  !-----------
3840  !
3841  ! on entry:
3842  !==========
3843  ! n = integer. The row dimension of the matrix A. The matrix
3844  !
3845  ! a,ja,ia = matrix stored in Compressed Sparse Row format.
3846  !
3847  ! lfil = integer. The fill-in parameter. Each row of L and each row
3848  ! of U will have a maximum of lfil elements (excluding the
3849  ! diagonal element). lfil must be .ge. 0.
3850  ! ** WARNING: THE MEANING OF LFIL HAS CHANGED WITH RESPECT TO
3851  ! EARLIER VERSIONS.
3852  !
3853  ! droptol = real*8. Sets the threshold for dropping small terms in the
3854  ! factorization. See below for details on dropping strategy.
3855  !
3856  !
3857  ! iwk = integer. The lengths of arrays alu and jlu. If the arrays
3858  ! are not big enough to store the ILU factorizations, ilut
3859  ! will stop with an error message.
3860  !
3861  ! On return:
3862  !===========
3863  !
3864  ! alu,jlu = matrix stored in Modified Sparse Row (MSR) format containing
3865  ! the L and U factors together. The diagonal (stored in
3866  ! alu(1:n) ) is inverted. Each i-th row of the alu,jlu matrix
3867  ! contains the i-th row of L (excluding the diagonal entry=1)
3868  ! followed by the i-th row of U.
3869  !
3870  ! ju = integer array of length n containing the pointers to
3871  ! the beginning of each row of U in the matrix alu,jlu.
3872  !
3873  ! ierr = integer. Error message with the following meaning.
3874  ! ierr = 0 --> successful return.
3875  ! ierr .gt. 0 --> zero pivot encountered at step number ierr.
3876  ! ierr = -1 --> Error. input matrix may be wrong.
3877  ! (The elimination process has generated a
3878  ! row in L or U whose length is .gt. n.)
3879  ! ierr = -2 --> The matrix L overflows the array al.
3880  ! ierr = -3 --> The matrix U overflows the array alu.
3881  ! ierr = -4 --> Illegal value for lfil.
3882  ! ierr = -5 --> zero row encountered.
3883  !
3884  ! work arrays:
3885  !=============
3886  ! jw = integer work array of length 2*n.
3887  ! w = real work array of length n+1.
3888  !
3889  !----------------------------------------------------------------------
3890  ! w, ju (1:n) store the working array [1:ii-1 = L-part, ii:n = u]
3891  ! jw(n+1:2n) stores nonzero indicators
3892  !
3893  ! Notes:
3894  ! ------
3895  ! The diagonal elements of the input matrix must be nonzero (at least
3896  ! 'structurally').
3897  !
3898  !----------------------------------------------------------------------*
3899  !---- Dual drop strategy works as follows. *
3900  ! *
3901  ! 1) Theresholding in L and U as set by droptol. Any element whose *
3902  ! magnitude is less than some tolerance (relative to the abs *
3903  ! value of diagonal element in u) is dropped. *
3904  ! *
3905  ! 2) Keeping only the largest lfil elements in the i-th row of L *
3906  ! and the largest lfil elements in the i-th row of U (excluding *
3907  ! diagonal elements). *
3908  ! *
3909  ! Flexibility: one can use droptol=0 to get a strategy based on *
3910  ! keeping the largest elements in each row of L and U. Taking *
3911  ! droptol .ne. 0 but lfil=n will give the usual threshold strategy *
3912  ! (however, fill-in is then mpredictible). *
3913  !----------------------------------------------------------------------*
3914  ! locals
3915  integer ju0,k,j1,j2,j,ii,i,lenl,lenu,jj,jrow,jpos,lenn
3916  real*8 tnorm, t, abs, s, fact
3917  if (lfil .lt. 0) goto 998
3918  !-----------------------------------------------------------------------
3919  ! initialize ju0 (points to next element to be added to alu,jlu)
3920  ! and pointer array.
3921  !-----------------------------------------------------------------------
3922  ju0 = n+2
3923  jlu(1) = ju0
3924  !
3925  ! initialize nonzero indicator array.
3926  !
3927  do j=1,n
3928  jw(n+j) = 0
3929  end do
3930  !-----------------------------------------------------------------------
3931  ! beginning of main loop.
3932  !-----------------------------------------------------------------------
3933  do ii = 1, n
3934 
3935  j1 = ia(ii)
3936  j2 = ia(ii+1) - 1
3937 
3938  tnorm = 0.0d0
3939  do k=j1,j2
3940  tnorm = tnorm+abs(a(k))
3941  end do
3942  if (abs(tnorm) .lt. tiny(1.)) goto 999
3943 
3944  tnorm = tnorm/real(j2-j1+1)
3945  !
3946  ! unpack L-part and U-part of row of A in arrays w
3947  !
3948  lenu = 1
3949  lenl = 0
3950  jw(ii) = ii
3951  w(ii) = 0.0
3952  jw(n+ii) = ii
3953  !
3954  do j = j1, j2
3955  k = ja(j)
3956  t = a(j)
3957  if (k .lt. ii) then
3958  lenl = lenl+1
3959  jw(lenl) = k
3960  w(lenl) = t
3961  jw(n+k) = lenl
3962  else if (k .eq. ii) then
3963  w(ii) = t
3964  else
3965  lenu = lenu+1
3966  jpos = ii+lenu-1
3967  jw(jpos) = k
3968  w(jpos) = t
3969  jw(n+k) = jpos
3970  endif
3971  end do
3972  jj = 0
3973  lenn = 0
3974  !
3975  ! eliminate previous rows
3976  !
3977 150 jj = jj+1
3978  if (jj .gt. lenl) goto 160
3979  !-----------------------------------------------------------------------
3980  ! in order to do the elimination in the correct order we must select
3981  ! the smallest column index among jw(k), k=jj+1, ..., lenl.
3982  !-----------------------------------------------------------------------
3983  jrow = jw(jj)
3984  k = jj
3985  !
3986  ! determine smallest column index
3987  !
3988  do j=jj+1,lenl
3989  if (jw(j) .lt. jrow) then
3990  jrow = jw(j)
3991  k = j
3992  endif
3993  end do
3994  !
3995  if (k .ne. jj) then
3996  ! exchange in jw
3997  j = jw(jj)
3998  jw(jj) = jw(k)
3999  jw(k) = j
4000  ! exchange in jr
4001  jw(n+jrow) = jj
4002  jw(n+j) = k
4003  ! exchange in w
4004  s = w(jj)
4005  w(jj) = w(k)
4006  w(k) = s
4007  endif
4008  !
4009  ! zero out element in row by setting jw(n+jrow) to zero.
4010  !
4011  jw(n+jrow) = 0
4012  !
4013  ! get the multiplier for row to be eliminated (jrow).
4014  !
4015  fact = w(jj)*alu(jrow)
4016  if (abs(fact) .le. droptol) goto 150
4017  !
4018  ! combine current row and row jrow
4019  !
4020  do k = ju(jrow), jlu(jrow+1)-1
4021  s = fact*alu(k)
4022  j = jlu(k)
4023  jpos = jw(n+j)
4024  if (j .ge. ii) then
4025  !
4026  ! dealing with upper part.
4027  !
4028  if (jpos .eq. 0) then
4029  !
4030  ! this is a fill-in element
4031  !
4032  lenu = lenu+1
4033  if (lenu .gt. n) goto 995
4034  i = ii+lenu-1
4035  jw(i) = j
4036  jw(n+j) = i
4037  w(i) = - s
4038  else
4039  !
4040  ! this is not a fill-in element
4041  !
4042  w(jpos) = w(jpos) - s
4043 
4044  endif
4045  else
4046  !
4047  ! dealing with lower part.
4048  !
4049  if (jpos .eq. 0) then
4050  !
4051  ! this is a fill-in element
4052  !
4053  lenl = lenl+1
4054  if (lenl .gt. n) goto 995
4055  jw(lenl) = j
4056  jw(n+j) = lenl
4057  w(lenl) = - s
4058  else
4059  !
4060  ! this is not a fill-in element
4061  !
4062  w(jpos) = w(jpos) - s
4063  endif
4064  endif
4065  end do
4066  !
4067  ! store this pivot element -- (from left to right -- no danger of
4068  ! overlap with the working elements in L (pivots).
4069  !
4070  lenn = lenn+1
4071  w(lenn) = fact
4072  jw(lenn) = jrow
4073  goto 150
4074 160 continue
4075  !
4076  ! reset double-pointer to zero (U-part)
4077  !
4078  do k=1, lenu
4079  jw(n+jw(ii+k-1)) = 0
4080  end do
4081  !
4082  ! update L-matrix
4083  !
4084  lenl = lenn
4085  lenn = min0(lenl,lfil)
4086  !
4087  ! sort by quick-split
4088  !
4089  call qsplit (w,jw,lenl,lenn)
4090  !
4091  ! store L-part
4092  !
4093  do k=1, lenn
4094  if (ju0 .gt. iwk) goto 996
4095  alu(ju0) = w(k)
4096  jlu(ju0) = jw(k)
4097  ju0 = ju0+1
4098  end do
4099  !
4100  ! save pointer to beginning of row ii of U
4101  !
4102  ju(ii) = ju0
4103  !
4104  ! update U-matrix -- first apply dropping strategy
4105  !
4106  lenn = 0
4107  do k=1, lenu-1
4108  if (abs(w(ii+k)) .gt. droptol*tnorm) then
4109  lenn = lenn+1
4110  w(ii+lenn) = w(ii+k)
4111  jw(ii+lenn) = jw(ii+k)
4112  endif
4113  enddo
4114  lenu = lenn+1
4115  lenn = min0(lenu,lfil)
4116  !
4117  call qsplit (w(ii+1), jw(ii+1), lenu-1,lenn)
4118  !
4119  ! copy
4120  !
4121  t = abs(w(ii))
4122  if (lenn + ju0 .gt. iwk) goto 997
4123  do k=ii+1,ii+lenn-1
4124  jlu(ju0) = jw(k)
4125  alu(ju0) = w(k)
4126  t = t + abs(w(k) )
4127  ju0 = ju0+1
4128  end do
4129  !
4130  ! store inverse of diagonal element of u
4131  !
4132  !2do check if it works ... after correction ...
4133  if (abs(w(ii)) .lt. tiny(1.d0)) w(ii) = (0.0001d0 + droptol)*tnorm
4134  !
4135  alu(ii) = 1.0d0/ w(ii)
4136  !
4137  ! update pointer to beginning of next row of U.
4138  !
4139  jlu(ii+1) = ju0
4140  !-----------------------------------------------------------------------
4141  ! end main loop
4142  !-----------------------------------------------------------------------
4143  end do
4144  ierr = 0
4145  return
4146  !
4147  ! incomprehensible error. Matrix must be wrong.
4148  !
4149 995 ierr = -1
4150  return
4151  !
4152  ! insufficient storage in L.
4153  !
4154 996 ierr = -2
4155  return
4156  !
4157  ! insufficient storage in U.
4158  !
4159 997 ierr = -3
4160  return
4161  !
4162  ! illegal lfil entered.
4163  !
4164 998 ierr = -4
4165  return
4166  !
4167  ! zero row encountered
4168  !
4169 999 ierr = -5
4170  return
4171  !----------------end-of-ilut--------------------------------------------
4172  !-----------------------------------------------------------------------

References qsplit().

◆ implu()

subroutine implu ( integer  np,
real*8  umm,
real*8  beta,
real*8, dimension(*)  ypiv,
real*8, dimension(*)  u,
logical, dimension(*)  permut,
logical  full 
)

Definition at line 2342 of file w3profsmd.F90.

2342  real*8 umm,beta,ypiv(*),u(*),x, xpiv
2343  logical full, perm, permut(*)
2344  integer np,k,npm1
2345  !-----------------------------------------------------------------------
2346  ! performs implicitly one step of the lu factorization of a
2347  ! banded hessenberg matrix.
2348  !-----------------------------------------------------------------------
2349  if (np .le. 1) goto 12
2350  npm1 = np - 1
2351  !
2352  ! -- perform previous step of the factorization-
2353  !
2354  do k=1,npm1
2355  if (.not. permut(k)) goto 5
2356  x=u(k)
2357  u(k) = u(k+1)
2358  u(k+1) = x
2359 5 u(k+1) = u(k+1) - ypiv(k)*u(k)
2360  end do
2361  !-----------------------------------------------------------------------
2362  ! now determine pivotal information to be used in the next call
2363  !-----------------------------------------------------------------------
2364 12 umm = u(np)
2365  perm = (beta .gt. abs(umm))
2366  if (.not. perm) goto 4
2367  xpiv = umm / beta
2368  u(np) = beta
2369  goto 8
2370 4 xpiv = beta/umm
2371 8 permut(np) = perm
2372  ypiv(np) = xpiv
2373  if (.not. full) return
2374  ! shift everything up if full...
2375  do k=1,npm1
2376  ypiv(k) = ypiv(k+1)
2377  permut(k) = permut(k+1)
2378  end do
2379  return
2380  !-----end-of-implu

◆ ldsol()

subroutine ldsol ( integer  n,
real*8, dimension(n)  x,
real*8, dimension(n)  y,
real*8, dimension(*)  al,
integer, dimension(*)  jal 
)

Definition at line 3258 of file w3profsmd.F90.

3258  integer n, jal(*)
3259  real*8 x(n), y(n), al(*)
3260  !-----------------------------------------------------------------------
3261  ! Solves L x = y L = triangular. MSR format
3262  !-----------------------------------------------------------------------
3263  ! solves a (non-unit) lower triangular system by standard (sequential)
3264  ! forward elimination - matrix stored in MSR format
3265  ! with diagonal elements already inverted (otherwise do inversion,
3266  ! al(1:n) = 1.0/al(1:n), before calling ldsol).
3267  !-----------------------------------------------------------------------
3268  !
3269  ! On entry:
3270  !----------
3271  ! n = integer. dimension of problem.
3272  ! y = real array containg the right hand side.
3273  !
3274  ! al,
3275  ! jal, = Lower triangular matrix stored in Modified Sparse Row
3276  ! format.
3277  !
3278  ! On return:
3279  !-----------
3280  ! x = The solution of L x = y .
3281  !--------------------------------------------------------------------
3282  ! local variables
3283  !
3284  integer k, j
3285  real*8 t
3286  !-----------------------------------------------------------------------
3287  x(1) = y(1)*al(1)
3288  do k = 2, n
3289  t = y(k)
3290  do j = jal(k), jal(k+1)-1
3291  t = t - al(j)*x(jal(j))
3292  end do
3293  x(k) = al(k)*t
3294  end do
3295  return
3296  !----------end-of-ldsol-------------------------------------------------
3297  !-----------------------------------------------------------------------

◆ ldsolc()

subroutine ldsolc ( integer  n,
real*8, dimension(n)  x,
real*8, dimension(n)  y,
real*8, dimension(*)  al,
integer, dimension(*)  jal 
)

Definition at line 3345 of file w3profsmd.F90.

3345  integer n, jal(*)
3346  real*8 x(n), y(n), al(*)
3347  !-----------------------------------------------------------------------
3348  ! Solves L x = y ; L = nonunit Low. Triang. MSC format
3349  !-----------------------------------------------------------------------
3350  ! solves a (non-unit) lower triangular system by standard (sequential)
3351  ! forward elimination - matrix stored in Modified Sparse Column format
3352  ! with diagonal elements already inverted (otherwise do inversion,
3353  ! al(1:n) = 1.0/al(1:n), before calling ldsol).
3354  !-----------------------------------------------------------------------
3355  !
3356  ! On entry:
3357  !----------
3358  ! n = integer. dimension of problem.
3359  ! y = real array containg the right hand side.
3360  !
3361  ! al,
3362  ! jal,
3363  ! ial, = Lower triangular matrix stored in Modified Sparse Column
3364  ! format.
3365  !
3366  ! On return:
3367  !-----------
3368  ! x = The solution of L x = y .
3369  !--------------------------------------------------------------------
3370  ! local variables
3371  !
3372  integer k, j
3373  real*8 t
3374  !-----------------------------------------------------------------------
3375  do k=1,n
3376  x(k) = y(k)
3377  end do
3378  do k = 1, n
3379  x(k) = x(k)*al(k)
3380  t = x(k)
3381  do j = jal(k), jal(k+1)-1
3382  x(jal(j)) = x(jal(j)) - t*al(j)
3383  end do
3384  end do
3385  !
3386  return
3387  !----------end-of-lsolc------------------------------------------------
3388  !-----------------------------------------------------------------------

◆ ldsoll()

subroutine ldsoll ( integer  n,
real*8, dimension(n)  x,
real*8, dimension(n)  y,
real*8, dimension(*)  al,
integer, dimension(*)  jal,
integer  nlev,
integer, dimension(n)  lev,
integer, dimension(nlev+1)  ilev 
)

Definition at line 3392 of file w3profsmd.F90.

3392  integer n, nlev, jal(*), ilev(nlev+1), lev(n)
3393  real*8 x(n), y(n), al(*)
3394  !-----------------------------------------------------------------------
3395  ! Solves L x = y L = triangular. Uses LEVEL SCHEDULING/MSR format
3396  !-----------------------------------------------------------------------
3397  !
3398  ! On entry:
3399  !----------
3400  ! n = integer. dimension of problem.
3401  ! y = real array containg the right hand side.
3402  !
3403  ! al,
3404  ! jal, = Lower triangular matrix stored in Modified Sparse Row
3405  ! format.
3406  ! nlev = number of levels in matrix
3407  ! lev = integer array of length n, containing the permutation
3408  ! that defines the levels in the level scheduling ordering.
3409  ! ilev = pointer to beginning of levels in lev.
3410  ! the numbers lev(i) to lev(i+1)-1 contain the row numbers
3411  ! that belong to level number i, in the level shcheduling
3412  ! ordering.
3413  !
3414  ! On return:
3415  !-----------
3416  ! x = The solution of L x = y .
3417  !--------------------------------------------------------------------
3418  integer ii, jrow, i, k
3419  real*8 t
3420  !
3421  ! outer loop goes through the levels. (SEQUENTIAL loop)
3422  !
3423  do ii=1, nlev
3424  !
3425  ! next loop executes within the same level. PARALLEL loop
3426  !
3427  do i=ilev(ii), ilev(ii+1)-1
3428  jrow = lev(i)
3429  !
3430  ! compute inner product of row jrow with x
3431  !
3432  t = y(jrow)
3433  do k=jal(jrow), jal(jrow+1)-1
3434  t = t - al(k)*x(jal(k))
3435  end do
3436  x(jrow) = t*al(jrow)
3437  end do
3438  end do
3439  return
3440  !-----------------------------------------------------------------------

◆ lsol()

subroutine lsol ( integer  n,
real*8, dimension(n)  x,
real*8, dimension(n)  y,
real*8, dimension(*)  al,
integer, dimension(*)  jal,
integer, dimension(n+1)  ial 
)

Definition at line 3215 of file w3profsmd.F90.

3215  integer n, jal(*),ial(n+1)
3216  real*8 x(n), y(n), al(*)
3217  !-----------------------------------------------------------------------
3218  ! solves L x = y ; L = lower unit triang. / CSR format
3219  !-----------------------------------------------------------------------
3220  ! solves a unit lower triangular system by standard (sequential )
3221  ! forward elimination - matrix stored in CSR format.
3222  !-----------------------------------------------------------------------
3223  !
3224  ! On entry:
3225  !----------
3226  ! n = integer. dimension of problem.
3227  ! y = real array containg the right side.
3228  !
3229  ! al,
3230  ! jal,
3231  ! ial, = Lower triangular matrix stored in compressed sparse row
3232  ! format.
3233  !
3234  ! On return:
3235  !-----------
3236  ! x = The solution of L x = y.
3237  !--------------------------------------------------------------------
3238  ! local variables
3239  !
3240  integer k, j
3241  real*8 t
3242  !-----------------------------------------------------------------------
3243  x(1) = y(1)
3244  do k = 2, n
3245  t = y(k)
3246  do j = ial(k), ial(k+1)-1
3247  t = t-al(j)*x(jal(j))
3248  end do
3249  x(k) = t
3250  end do
3251  !
3252  return
3253  !----------end-of-lsol--------------------------------------------------
3254  !-----------------------------------------------------------------------

◆ lsolc()

subroutine lsolc ( integer  n,
real*8, dimension(n)  x,
real*8, dimension(n)  y,
real*8, dimension(*)  al,
integer, dimension(*)  jal,
integer, dimension(*)  ial 
)

Definition at line 3301 of file w3profsmd.F90.

3301  integer n, jal(*),ial(*)
3302  real*8 x(n), y(n), al(*)
3303  !-----------------------------------------------------------------------
3304  ! SOLVES L x = y ; where L = unit lower trang. CSC format
3305  !-----------------------------------------------------------------------
3306  ! solves a unit lower triangular system by standard (sequential )
3307  ! forward elimination - matrix stored in CSC format.
3308  !-----------------------------------------------------------------------
3309  !
3310  ! On entry:
3311  !----------
3312  ! n = integer. dimension of problem.
3313  ! y = real*8 array containg the right side.
3314  !
3315  ! al,
3316  ! jal,
3317  ! ial, = Lower triangular matrix stored in compressed sparse column
3318  ! format.
3319  !
3320  ! On return:
3321  !-----------
3322  ! x = The solution of L x = y.
3323  !-----------------------------------------------------------------------
3324  ! local variables
3325  !
3326  integer k, j
3327  real*8 t
3328  !-----------------------------------------------------------------------
3329  do k=1,n
3330  x(k) = y(k)
3331  end do
3332  do k = 1, n-1
3333  t = x(k)
3334  do j = ial(k), ial(k+1)-1
3335  x(jal(j)) = x(jal(j)) - t*al(j)
3336  end do
3337  end do
3338  !
3339  return
3340  !----------end-of-lsolc-------------------------------------------------
3341  !-----------------------------------------------------------------------

◆ lusol()

subroutine lusol ( integer  n,
real*8, dimension(n)  y,
real*8, dimension(n)  x,
real*8, dimension(*)  alu,
integer, dimension(*)  jlu,
integer, dimension(*)  ju 
)

Definition at line 3621 of file w3profsmd.F90.

3621  implicit none
3622 
3623  integer :: n, jlu(*), ju(*)
3624  real*8 :: x(n), y(n), alu(*)
3625 
3626  !-----------------------------------------------------------------------
3627  integer :: i,k
3628  !
3629  ! forward solve
3630  !
3631  do i = 1, n
3632  x(i) = y(i)
3633  do k=jlu(i),ju(i)-1
3634  x(i) = x(i) - alu(k)* x(jlu(k))
3635  end do
3636  end do
3637  do i = n, 1, -1
3638  do k=ju(i),jlu(i+1)-1
3639  x(i) = x(i) - alu(k)*x(jlu(k))
3640  end do
3641  x(i) = alu(i)*x(i)
3642  end do
3643  !
3644  return
3645  !----------------end of lusol ------------------------------------------

Referenced by pgmres(), and runrc().

◆ lutsol()

subroutine lutsol ( integer  n,
real*8, dimension(n)  y,
real*8, dimension(n)  x,
real*8, dimension(*)  alu,
integer, dimension(*)  jlu,
integer, dimension(*)  ju 
)

Definition at line 3649 of file w3profsmd.F90.

3649  implicit none
3650 
3651  integer :: n, jlu(*), ju(*)
3652  real*8 :: x(n), y(n), alu(*)
3653 
3654  !-----------------------------------------------------------------------
3655  ! local variables
3656  !
3657  integer :: i,k
3658  !
3659  do i = 1, n
3660  x(i) = y(i)
3661  end do
3662  !
3663  ! forward solve (with U^T)
3664  !
3665  do i = 1, n
3666  x(i) = x(i) * alu(i)
3667  do k=ju(i),jlu(i+1)-1
3668  x(jlu(k)) = x(jlu(k)) - alu(k)* x(i)
3669  end do
3670  end do
3671  !
3672  ! backward solve (with L^T)
3673  !
3674  do i = n, 1, -1
3675  do k=jlu(i),ju(i)-1
3676  x(jlu(k)) = x(jlu(k)) - alu(k)*x(i)
3677  end do
3678  end do
3679  !
3680  return
3681  !----------------end of lutsol -----------------------------------------
3682  !-----------------------------------------------------------------------

Referenced by runrc().

◆ mgsro()

subroutine mgsro ( logical  full,
integer  lda,
integer  n,
integer  m,
integer  ind,
real*8  ops,
real*8, dimension(lda,m)  vec,
real*8, dimension(m)  hh,
integer  ierr 
)

Definition at line 2664 of file w3profsmd.F90.

2664  implicit none
2665  logical full
2666  integer lda,m,n,ind,ierr
2667  real*8 ops,hh(m),vec(lda,m)
2668  !-----------------------------------------------------------------------
2669  ! MGSRO -- Modified Gram-Schmidt procedure with Selective Re-
2670  ! Orthogonalization
2671  ! The ind'th vector of VEC is orthogonalized against the rest of
2672  ! the vectors.
2673  !
2674  ! The test for performing re-orthogonalization is performed for
2675  ! each indivadual vectors. If the cosine between the two vectors
2676  ! is greater than 0.99 (REORTH = 0.99**2), re-orthogonalization is
2677  ! performed. The norm of the 'new' vector is kept in variable NRM0,
2678  ! and updated after operating with each vector.
2679  !
2680  ! full -- .ture. if it is necessary to orthogonalize the ind'th
2681  ! against all the vectors vec(:,1:ind-1), vec(:,ind+2:m)
2682  ! .false. only orthogonalize againt vec(:,1:ind-1)
2683  ! lda -- the leading dimension of VEC
2684  ! n -- length of the vector in VEC
2685  ! m -- number of vectors can be stored in VEC
2686  ! ind -- index to the vector to be changed
2687  ! ops -- operation counts
2688  ! vec -- vector of LDA X M storing the vectors
2689  ! hh -- coefficient of the orthogonalization
2690  ! ierr -- error code
2691  ! 0 : successful return
2692  ! -1: zero input vector
2693  ! -2: input vector contains abnormal numbers
2694  ! -3: input vector is a linear combination of others
2695  !
2696  ! External routines used: real*8 ddot
2697  !-----------------------------------------------------------------------
2698  integer i,k
2699  real*8 nrm0, nrm1, fct, thr, ddot, zero, one, reorth
2700  parameter(zero=0.0d0, one=1.0d0, reorth=0.98d0)
2701  external ddot
2702  !
2703  ! compute the norm of the input vector
2704  !
2705  nrm0 = ddot(n,vec(1,ind),vec(1,ind))
2706  ops = ops + n + n
2707  thr = nrm0 * reorth
2708  if (nrm0.le.zero) then
2709  ierr = - 1
2710  return
2711  else if (nrm0.gt.zero .and. one/nrm0.gt.zero) then
2712  ierr = 0
2713  else
2714  ierr = -2
2715  return
2716  endif
2717  !
2718  ! Modified Gram-Schmidt loop
2719  !
2720  if (full) then
2721  do i = ind+1, m
2722  fct = ddot(n,vec(1,ind),vec(1,i))
2723  hh(i) = fct
2724  do k = 1, n
2725  vec(k,ind) = vec(k,ind) - fct * vec(k,i)
2726  end do
2727  ops = ops + 4 * n + 2
2728  if (fct*fct.gt.thr) then
2729  fct = ddot(n,vec(1,ind),vec(1,i))
2730  hh(i) = hh(i) + fct
2731  do k = 1, n
2732  vec(k,ind) = vec(k,ind) - fct * vec(k,i)
2733  end do
2734  ops = ops + 4*n + 1
2735  endif
2736  nrm0 = nrm0 - hh(i) * hh(i)
2737  if (nrm0.lt.zero) nrm0 = zero
2738  thr = nrm0 * reorth
2739  end do
2740  endif
2741  !
2742  do i = 1, ind-1
2743  fct = ddot(n,vec(1,ind),vec(1,i))
2744  hh(i) = fct
2745  do k = 1, n
2746  vec(k,ind) = vec(k,ind) - fct * vec(k,i)
2747  end do
2748  ops = ops + 4 * n + 2
2749  if (fct*fct.gt.thr) then
2750  fct = ddot(n,vec(1,ind),vec(1,i))
2751  hh(i) = hh(i) + fct
2752  do k = 1, n
2753  vec(k,ind) = vec(k,ind) - fct * vec(k,i)
2754  end do
2755  ops = ops + 4*n + 1
2756  endif
2757  nrm0 = nrm0 - hh(i) * hh(i)
2758  if (nrm0.lt.zero) nrm0 = zero
2759  thr = nrm0 * reorth
2760  end do
2761  !
2762  ! test the resulting vector
2763  !
2764  nrm1 = sqrt(ddot(n,vec(1,ind),vec(1,ind)))
2765  ops = ops + n + n
2766  hh(ind) = nrm1 ! statement label 75
2767  if (nrm1.le.zero) then
2768  ierr = -3
2769  return
2770  endif
2771  !
2772  ! scale the resulting vector
2773  !
2774  fct = one / nrm1
2775  do k = 1, n
2776  vec(k,ind) = vec(k,ind) * fct
2777  end do
2778  ops = ops + n + 1
2779  !
2780  ! normal return
2781  !
2782  ierr = 0
2783  return
2784  ! end subroutine mgsro

References ddot().

◆ pgmres()

subroutine pgmres ( integer  n,
integer  im,
real*8, dimension(*)  rhs,
real*8, dimension(*)  sol,
real*8  eps,
integer  maxits,
real*8, dimension(nnz)  aspar,
integer  nnz,
integer, dimension(n+1)  ia,
integer, dimension(nnz)  ja,
real*8, dimension(nnz+1)  alu,
integer, dimension(nnz+1)  jlu,
integer, dimension(n)  ju,
real*8, dimension(n,im+1)  vv,
integer  ierr 
)

Definition at line 4240 of file w3profsmd.F90.

4240  !-----------------------------------------------------------------------
4241  ! use datapool, only : nnz, ia, ja, alu, jlu, ju, vv, aspar!, rhs, sol
4242  implicit none
4243 
4244  integer :: n, im, maxits, ierr, nnz
4245 
4246  integer :: ja(nnz), ia(n+1)
4247  integer :: jlu(nnz+1), ju(n)
4248  real*8 :: vv(n,im+1), alu(nnz+1)
4249  real*8 :: aspar(nnz)
4250 
4251  real*8 :: rhs(*), sol(*)
4252 
4253  real*8 :: eps
4254  real*8 :: eps1, epsmac, gam, t, ddot, dnrm2, ro, tl
4255 
4256  integer :: i,i1,j,jj,k,k1,iii,ii,ju0
4257  integer :: its,jrow,jcol,jf,jm,js,jw
4258 
4259  real*8 :: hh(im+1,im), c(im), s(im), rs(im+1)
4260  real*8 :: iw(n)
4261 
4262  logical :: lblas = .false. ! use sparskit matvec and external blas libs (true), don't use them (false)
4263  logical :: lilu = .true. ! use simple ilu preconditioner
4264 
4265  data epsmac/1.d-16/
4266 
4267  ! ilu0 preconditioner
4268 
4269  if (lilu) then
4270  ju0 = n+2
4271  jlu(1) = ju0 !!!
4272  iw = 0
4273  do ii = 1, n
4274  js = ju0
4275  do j=ia(ii),ia(ii+1)-1
4276  jcol = ja(j)
4277  if (jcol .eq. ii) then
4278  alu(ii) = aspar(j)
4279  iw(jcol) = ii
4280  ju(ii) = ju0 !!!
4281  else
4282  alu(ju0) = aspar(j)
4283  jlu(ju0) = ja(j)
4284  iw(jcol) = ju0
4285  ju0 = ju0+1
4286  endif
4287  end do
4288  jlu(ii+1) = ju0 !!!
4289  jf = ju0-1
4290  jm = ju(ii)-1
4291  ! exit if diagonal element is reached.
4292  do j=js, jm
4293  jrow = jlu(j)
4294  tl = alu(j)*alu(jrow)
4295  alu(j) = tl
4296  ! perform linear combination
4297  do jj = ju(jrow), jlu(jrow+1)-1
4298  jw = int(iw(jlu(jj)))
4299  if (jw .ne. 0) then
4300  alu(jw) = alu(jw) - tl*alu(jj)
4301  ! write(*,*) ii, jw, jj
4302  end if
4303  end do
4304  end do
4305  ! invert and store diagonal element.
4306  if (abs(alu(ii)) .lt. epsmac) then
4307  write (*,*) 'zero pivot'
4308  stop
4309  end if
4310  alu(ii) = 1.0d0/alu(ii)
4311  ! reset pointer iw to zero
4312  iw(ii) = 0
4313  do i = js, jf
4314  iw(jlu(i)) = 0
4315  end do
4316  end do
4317  ! end preconditioner
4318  end if
4319  !-------------------------------------------------------------
4320  its = 0
4321  ! outer loop starts here..
4322  if (lblas) then
4323  call amux (n, sol, vv, aspar, ja, ia)
4324  else
4325  do iii = 1, n
4326  t = 0.0d0
4327  do k = ia(iii), ia(iii+1)-1
4328  t = t + aspar(k) * sol(ja(k))
4329  end do
4330  vv(iii,1) = t
4331  end do
4332  end if
4333  do j=1,n
4334  vv(j,1) = rhs(j) - vv(j,1)
4335  end do
4336 20 if (lblas) then
4337  ro = dnrm2(n, vv)
4338  else
4339  ro = sqrt(sum(vv(:,1)*vv(:,1)))
4340  end if
4341  if (abs(ro) .lt. epsmac) goto 999
4342  t = 1.0d0 / ro
4343  do j=1, n
4344  vv(j,1) = vv(j,1)*t
4345  end do
4346  if (its .eq. 0) eps1=eps*ro
4347  ! initialize 1-st term of rhs of hessenberg system..
4348  rs(1) = ro
4349  i = 0
4350 4 i=i+1
4351  its = its + 1
4352  i1 = i + 1
4353  if (lblas) then
4354  call lusol (n, vv(1,i), rhs, alu, jlu, ju)
4355  call amux (n, rhs, vv(1,i1), aspar, ja, ia)
4356  else
4357  do iii = 1, n !- lusol
4358  rhs(iii) = vv(iii,i)
4359  do k=jlu(iii),ju(iii)-1
4360  rhs(iii) = rhs(iii) - alu(k)* rhs(jlu(k))
4361  end do
4362  end do
4363  do iii = n, 1, -1
4364  do k=ju(iii),jlu(iii+1)-1
4365  rhs(iii) = rhs(iii) - alu(k)*rhs(jlu(k))
4366  end do
4367  rhs(iii) = alu(iii)*rhs(iii)
4368  end do
4369  do iii = 1, n !- amux
4370  t = 0.0d0
4371  do k = ia(iii), ia(iii+1)-1
4372  t = t + aspar(k) * rhs(ja(k))
4373  end do
4374  vv(iii,i1) = t
4375  end do
4376  end if
4377  ! modified gram - schmidt...
4378  if (lblas) then
4379  do j=1, i
4380  t = ddot(n, vv(1,j),vv(1,i1))
4381  hh(j,i) = t
4382  call daxpy(n, -t, vv(1,j), 1, vv(1,i1), 1)
4383  t = dnrm2(n, vv(1,i1))
4384  end do
4385  else
4386  do j=1, i
4387  t = 0.d0
4388  do iii = 1,n
4389  t = t + vv(iii,j)*vv(iii,i1)
4390  end do
4391  hh(j,i) = t
4392  vv(:,i1) = vv(:,i1) - t * vv(:,j)
4393  t = sqrt(sum(vv(:,i1)*vv(:,i1)))
4394  end do
4395  end if
4396  hh(i1,i) = t
4397  if ( abs(t) .lt. epsmac) goto 58
4398  t = 1.0d0/t
4399  do k=1,n
4400  vv(k,i1) = vv(k,i1)*t
4401  end do
4402  ! done with modified gram schimd and arnoldi step.. now update factorization of hh
4403 58 if (i .eq. 1) goto 121
4404  do k=2,i
4405  k1 = k-1
4406  t = hh(k1,i)
4407  hh(k1,i) = c(k1)*t + s(k1)*hh(k,i)
4408  hh(k,i) = -s(k1)*t + c(k1)*hh(k,i)
4409  end do
4410 121 gam = sqrt(hh(i,i)**2 + hh(i1,i)**2)
4411  if (abs(gam) .lt. epsmac) gam = epsmac
4412  ! get next plane rotation
4413  c(i) = hh(i,i)/gam
4414  s(i) = hh(i1,i)/gam
4415  rs(i1) = -s(i)*rs(i)
4416  rs(i) = c(i)*rs(i)
4417  ! detrermine residual norm and test for convergence-
4418  hh(i,i) = c(i)*hh(i,i) + s(i)*hh(i1,i)
4419  ro = abs(rs(i1))
4420  if (i .lt. im .and. (ro .gt. eps1)) goto 4
4421  ! now compute solution. first solve upper triangular system.
4422  rs(i) = rs(i)/hh(i,i)
4423  do ii=2,i
4424  k=i-ii+1
4425  k1 = k+1
4426  t=rs(k)
4427  do j=k1,i
4428  t = t-hh(k,j)*rs(j)
4429  end do
4430  rs(k) = t/hh(k,k)
4431  end do
4432  ! form linear combination of v(*,i)'s to get solution
4433  t = rs(1)
4434  do k=1, n
4435  rhs(k) = vv(k,1)*t
4436  end do
4437  do j = 2, i
4438  t = rs(j)
4439  do k=1, n
4440  rhs(k) = rhs(k)+t*vv(k,j)
4441  end do
4442  end do
4443  ! call preconditioner.
4444  if (lblas) then
4445  call lusol (n, rhs, rhs, alu, jlu, ju)
4446  else
4447  do iii = 1, n
4448  do k=jlu(iii),ju(iii)-1
4449  rhs(iii) = rhs(iii) - alu(k)* rhs(jlu(k))
4450  end do
4451  end do
4452  do iii = n, 1, -1
4453  do k=ju(iii),jlu(iii+1)-1
4454  rhs(iii) = rhs(iii) - alu(k)*rhs(jlu(k))
4455  end do
4456  rhs(iii) = alu(iii)*rhs(iii)
4457  end do
4458  end if
4459  do k=1, n
4460  sol(k) = sol(k) + rhs(k)
4461  end do
4462  ! restart outer loop when necessary
4463  if (ro .le. eps1) goto 990
4464  if (its .ge. maxits) goto 991
4465  ! else compute residual vector and continue..
4466  do j=1,i
4467  jj = i1-j+1
4468  rs(jj-1) = -s(jj-1)*rs(jj)
4469  rs(jj) = c(jj-1)*rs(jj)
4470  end do
4471  do j=1,i1
4472  t = rs(j)
4473  if (j .eq. 1) t = t-1.0d0
4474  if (lblas) then
4475  call daxpy (n, t, vv(1,j), 1, vv, 1)
4476  else
4477  vv(:,j) = vv(:,j) + t * vv(:,1)
4478  end if
4479  end do
4480  ! 199 format(' its =', i4, ' res. norm =', d20.6)
4481  ! restart outer loop.
4482  goto 20
4483 990 ierr = 0
4484  return
4485 991 ierr = 1
4486  return
4487 999 continue
4488  ierr = -1
4489  return
4490  !---------------------------------------------------------------------

References amux(), daxpy(), ddot(), dnrm2(), and lusol().

◆ qsplit()

subroutine qsplit ( real*8, dimension(n)  a,
integer, dimension(n)  ind,
integer  n,
integer  ncut 
)

Definition at line 3686 of file w3profsmd.F90.

3686  implicit none
3687 
3688  integer :: n, ind(n), ncut
3689  real*8 :: a(n)
3690 
3691  !-----------------------------------------------------------------------
3692  ! does a quick-sort split of a real array.
3693  ! on input a(1:n). is a real array
3694  ! on output a(1:n) is permuted such that its elements satisfy:
3695  !
3696  ! abs(a(i)) .ge. abs(a(ncut)) for i .lt. ncut and
3697  ! abs(a(i)) .le. abs(a(ncut)) for i .gt. ncut
3698  !
3699  ! ind(1:n) is an integer array which permuted in the same way as a(*).
3700  !-----------------------------------------------------------------------
3701  real*8 :: tmp, abskey
3702  integer :: itmp, first, last, j, mid
3703  !-----
3704  first = 1
3705  last = n
3706  if (ncut .lt. first .or. ncut .gt. last) return
3707  !
3708  ! outer loop -- while mid .ne. ncut do
3709  !
3710 1 mid = first
3711  abskey = abs(a(mid))
3712  do j=first+1, last
3713  if (abs(a(j)) .gt. abskey) then
3714  mid = mid+1
3715  ! interchange
3716  tmp = a(mid)
3717  itmp = ind(mid)
3718  a(mid) = a(j)
3719  ind(mid) = ind(j)
3720  a(j) = tmp
3721  ind(j) = itmp
3722  endif
3723  end do
3724  !
3725  ! interchange
3726  !
3727  tmp = a(mid)
3728  a(mid) = a(first)
3729  a(first) = tmp
3730  !
3731  itmp = ind(mid)
3732  ind(mid) = ind(first)
3733  ind(first) = itmp
3734  !
3735  ! test for while loop
3736  !
3737  if (mid .eq. ncut) return
3738  if (mid .gt. ncut) then
3739  last = mid-1
3740  else
3741  first = mid+1
3742  endif
3743  goto 1
3744  !----------------end-of-qsplit------------------------------------------
3745  !-----------------------------------------------------------------------

Referenced by ilut().

◆ runrc()

subroutine runrc ( integer  n,
real*8, dimension(n)  rhs,
real*8, dimension(n)  sol,
integer, dimension(16)  ipar,
real*8, dimension(16)  fpar,
real*8, dimension(*)  wk,
real*8, dimension(n)  guess,
real*8, dimension(*)  a,
integer, dimension(*)  ja,
integer, dimension(n+1)  ia,
real*8, dimension(*)  au,
integer, dimension(*)  jau,
integer, dimension(*)  ju,
external  solver 
)

Definition at line 3748 of file w3profsmd.F90.

3748  implicit none
3749  integer n,ipar(16),ia(n+1),ja(*),ju(*),jau(*)
3750  real*8 fpar(16),rhs(n),sol(n),guess(n),wk(*),a(*),au(*)
3751  external solver
3752  !-----------------------------------------------------------------------
3753  ! the actual tester. It starts the iterative linear system solvers
3754  ! with a initial guess suppied by the user.
3755  !
3756  ! The structure {au, jau, ju} is assumed to have the output from
3757  ! the ILU* routines in ilut.f.
3758  !
3759  !-----------------------------------------------------------------------
3760  ! local variables
3761  !
3762  integer :: i, its
3763  ! real :: dtime, dt(2), time
3764  ! external dtime
3765  save its
3766  !
3767  ! ipar(2) can be 0, 1, 2, please don't use 3
3768  !
3769  if (ipar(2).gt.2) then
3770  WRITE(*,*) 'I can not do both left and right preconditioning.'
3771  return
3772  endif
3773 
3774  its = 0
3775  !
3776  do i = 1, n
3777  sol(i) = guess(i)
3778  enddo
3779  !
3780  ipar(1) = 0
3781  ! time = dtime(dt)
3782 
3783 10 call solver(n,rhs,sol,ipar,fpar,wk)
3784 
3785  if (ipar(7).ne.its) then
3786  its = ipar(7)
3787  endif
3788  if (ipar(1).eq.1) then
3789  call amux(n, wk(ipar(8)), wk(ipar(9)), a, ja, ia)
3790  goto 10
3791  else if (ipar(1).eq.2) then
3792  call atmux(n, wk(ipar(8)), wk(ipar(9)), a, ja, ia)
3793  goto 10
3794  else if (ipar(1).eq.3 .or. ipar(1).eq.5) then
3795  call lusol(n,wk(ipar(8)),wk(ipar(9)),au,jau,ju)
3796  goto 10
3797  else if (ipar(1).eq.4 .or. ipar(1).eq.6) then
3798  call lutsol(n,wk(ipar(8)),wk(ipar(9)),au,jau,ju)
3799  goto 10
3800  else if (ipar(1).le.0) then
3801  if (ipar(1).eq.0) then
3802  ! WRITE(*,*) 'Iterative sovler has satisfied convergence test.'
3803  else if (ipar(1).eq.-1) then
3804  WRITE(*,*) 'Iterative solver has iterated too many times.'
3805  else if (ipar(1).eq.-2) then
3806  WRITE(*,*) 'Iterative solver was not given enough work space.'
3807  WRITE(*,*) 'The work space should at least have ', ipar(4), &
3808  & ' elements.'
3809  else if (ipar(1).eq.-3) then
3810  WRITE(*,*) 'Iterative sovler is facing a break-down.'
3811  else
3812  WRITE(*,*) 'Iterative solver terminated. code =', ipar(1)
3813  endif
3814  endif

References amux(), atmux(), lusol(), and lutsol().

Referenced by w3profsmd::w3xypfsnimp().

◆ stopbis()

logical function stopbis ( integer  n,
integer, dimension(16)  ipar,
integer  mvpi,
real*8, dimension(16)  fpar,
real*8, dimension(n)  r,
real*8, dimension(n)  delx,
real*8  sx 
)

Definition at line 2465 of file w3profsmd.F90.

2465  implicit none
2466  integer n,mvpi,ipar(16)
2467  real*8 fpar(16), r(n), delx(n), sx, ddot
2468  external ddot
2469  !-----------------------------------------------------------------------
2470  ! function for determining the stopping criteria. return value of
2471  ! true if the stopbis criteria is satisfied.
2472  !-----------------------------------------------------------------------
2473  if (ipar(11) .eq. 1) then
2474  stopbis = .true.
2475  else
2476  stopbis = .false.
2477  endif
2478  if (ipar(6).gt.0 .and. ipar(7).ge.ipar(6)) then
2479  ipar(1) = -1
2480  stopbis = .true.
2481  endif
2482  if (stopbis) return
2483  !
2484  ! computes errors
2485  !
2486  fpar(5) = sqrt(ddot(n,r,r))
2487  fpar(11) = fpar(11) + 2 * n
2488  if (ipar(3).lt.0) then
2489  !
2490  ! compute the change in the solution vector
2491  !
2492  fpar(6) = sx * sqrt(ddot(n,delx,delx))
2493  fpar(11) = fpar(11) + 2 * n
2494  if (ipar(7).lt.mvpi+mvpi+1) then
2495  !
2496  ! if this is the end of the first iteration, set fpar(3:4)
2497  !
2498  fpar(3) = fpar(6)
2499  if (ipar(3).eq.-1) then
2500  fpar(4) = fpar(1) * fpar(3) + fpar(2)
2501  endif
2502  endif
2503  else
2504  fpar(6) = fpar(5)
2505  endif
2506  !
2507  ! .. the test is struct this way so that when the value in fpar(6)
2508  ! is not a valid number, STOPBIS is set to .true.
2509  !
2510  if (fpar(6).gt.fpar(4)) then
2511  stopbis = .false.
2512  ipar(11) = 0
2513  else
2514  stopbis = .true.
2515  ipar(11) = 1
2516  endif
2517  !
2518  return

References ddot().

Referenced by bcgstab().

◆ tidycg()

subroutine tidycg ( integer  n,
integer, dimension(16)  ipar,
real*8, dimension(16)  fpar,
real*8, dimension(n)  sol,
real*8, dimension(n)  delx 
)

Definition at line 2523 of file w3profsmd.F90.

2523  implicit none
2524  integer i,n,ipar(16)
2525  real*8 fpar(16),sol(n),delx(n)
2526  !-----------------------------------------------------------------------
2527  ! Some common operations required before terminating the CG routines
2528  !-----------------------------------------------------------------------
2529  real*8 zero
2530  parameter(zero=0.0d0)
2531  !
2532  if (ipar(12).ne.0) then
2533  ipar(1) = ipar(12)
2534  else if (ipar(1).gt.0) then
2535  if ((ipar(3).eq.999 .and. ipar(11).eq.1) .or. &
2536  & fpar(6).le.fpar(4)) then
2537  ipar(1) = 0
2538  else if (ipar(7).ge.ipar(6) .and. ipar(6).gt.0) then
2539  ipar(1) = -1
2540  else
2541  ipar(1) = -10
2542  endif
2543  endif
2544  if (fpar(3).gt.zero .and. fpar(6).gt.zero .and. ipar(7).gt.ipar(13)) then
2545  fpar(7) = log10(fpar(3) / fpar(6)) / dble(ipar(7)-ipar(13))
2546  else
2547  fpar(7) = zero
2548  endif
2549  do i = 1, n
2550  sol(i) = sol(i) + delx(i)
2551  enddo
2552  return

Referenced by bcgstab().

◆ udsol()

subroutine udsol ( integer  n,
real*8, dimension(n)  x,
real*8, dimension(n)  y,
real*8, dimension(*)  au,
integer, dimension(*)  jau 
)

Definition at line 3487 of file w3profsmd.F90.

3487  integer n, jau(*)
3488  real*8 x(n), y(n),au(*)
3489  !-----------------------------------------------------------------------
3490  ! Solves U x = y ; U = upper triangular in MSR format
3491  !-----------------------------------------------------------------------
3492  ! solves a non-unit upper triangular matrix by standard (sequential )
3493  ! backward elimination - matrix stored in MSR format.
3494  ! with diagonal elements already inverted (otherwise do inversion,
3495  ! au(1:n) = 1.0/au(1:n), before calling).
3496  !-----------------------------------------------------------------------
3497  !
3498  ! On entry:
3499  !----------
3500  ! n = integer. dimension of problem.
3501  ! y = real array containg the right side.
3502  !
3503  ! au,
3504  ! jau, = Lower triangular matrix stored in modified sparse row
3505  ! format.
3506  !
3507  ! On return:
3508  !-----------
3509  ! x = The solution of U x = y .
3510  !--------------------------------------------------------------------
3511  ! local variables
3512  !
3513  integer k, j
3514  real*8 t
3515  !-----------------------------------------------------------------------
3516  x(n) = y(n)*au(n)
3517  do k = n-1,1,-1
3518  t = y(k)
3519  do j = jau(k), jau(k+1)-1
3520  t = t - au(j)*x(jau(j))
3521  end do
3522  x(k) = au(k)*t
3523  end do
3524  !
3525  return
3526  !----------end-of-udsol-------------------------------------------------
3527  !-----------------------------------------------------------------------

◆ udsolc()

subroutine udsolc ( integer  n,
real*8, dimension(n)  x,
real*8, dimension(n)  y,
real*8, dimension(*)  au,
integer, dimension(*)  jau 
)

Definition at line 3575 of file w3profsmd.F90.

3575  integer n, jau(*)
3576  real*8 x(n), y(n), au(*)
3577  !-----------------------------------------------------------------------
3578  ! Solves U x = y ; U = nonunit Up. Triang. MSC format
3579  !-----------------------------------------------------------------------
3580  ! solves a (non-unit) upper triangular system by standard (sequential)
3581  ! forward elimination - matrix stored in Modified Sparse Column format
3582  ! with diagonal elements already inverted (otherwise do inversion,
3583  ! auuuul(1:n) = 1.0/au(1:n), before calling ldsol).
3584  !-----------------------------------------------------------------------
3585  !
3586  ! On entry:
3587  !----------
3588  ! n = integer. dimension of problem.
3589  ! y = real*8 array containg the right hand side.
3590  !
3591  ! au,
3592  ! jau, = Upper triangular matrix stored in Modified Sparse Column
3593  ! format.
3594  !
3595  ! On return:
3596  !-----------
3597  ! x = The solution of U x = y .
3598  !--------------------------------------------------------------------
3599  ! local variables
3600  !
3601  integer k, j
3602  real*8 t
3603  !-----------------------------------------------------------------------
3604  do k=1,n
3605  x(k) = y(k)
3606  end do
3607  do k = n,1,-1
3608  x(k) = x(k)*au(k)
3609  t = x(k)
3610  do j = jau(k), jau(k+1)-1
3611  x(jau(j)) = x(jau(j)) - t*au(j)
3612  end do
3613  end do
3614  !
3615  return
3616  !----------end-of-udsolc------------------------------------------------
3617  !-----------------------------------------------------------------------

◆ uppdir()

subroutine uppdir ( integer  n,
real*8, dimension(n,lbp)  p,
integer  np,
integer  lbp,
integer  indp,
real*8, dimension(*)  y,
real*8, dimension(*)  u,
real*8, dimension(*)  usav,
real*8  flops 
)

Definition at line 2384 of file w3profsmd.F90.

2384  implicit none
2385 
2386  integer :: k,np,n,npm1,j,ju,indp,lbp
2387  real*8 :: p(n,lbp), y(*), u(*), usav(*), x, flops
2388 
2389  !-----------------------------------------------------------------------
2390  ! updates the conjugate directions p given the upper part of the
2391  ! banded upper triangular matrix u. u contains the non zero
2392  ! elements of the column of the triangular matrix..
2393  !-----------------------------------------------------------------------
2394  real*8 zero
2395  parameter(zero=0.0d0)
2396  !
2397  npm1=np-1
2398  if (np .le. 1) goto 12
2399  j=indp
2400  ju = npm1
2401 10 if (j .le. 0) j=lbp
2402  x = u(ju) /usav(j)
2403  if (x .eq. zero) goto 115
2404  do k=1,n
2405  y(k) = y(k) - x*p(k,j)
2406  end do
2407  flops = flops + 2*n
2408 115 j = j-1
2409  ju = ju -1
2410  if (ju .ge. 1) goto 10
2411 12 indp = indp + 1
2412  if (indp .gt. lbp) indp = 1
2413  usav(indp) = u(np)
2414  do k=1,n
2415  p(k,indp) = y(k)
2416  end do
2417  return
2418  !-----------------------------------------------------------------------
2419  !-------end-of-uppdir---------------------------------------------------

◆ usol()

subroutine usol ( integer  n,
real*8, dimension(n)  x,
real*8, dimension(n)  y,
real*8, dimension(*)  au,
integer, dimension(*)  jau,
integer, dimension(n+1)  iau 
)

Definition at line 3444 of file w3profsmd.F90.

3444  integer n, jau(*),iau(n+1)
3445  real*8 x(n), y(n), au(*)
3446  !-----------------------------------------------------------------------
3447  ! Solves U x = y U = unit upper triangular.
3448  !-----------------------------------------------------------------------
3449  ! solves a unit upper triangular system by standard (sequential )
3450  ! backward elimination - matrix stored in CSR format.
3451  !-----------------------------------------------------------------------
3452  !
3453  ! On entry:
3454  !----------
3455  ! n = integer. dimension of problem.
3456  ! y = real array containg the right side.
3457  !
3458  ! au,
3459  ! jau,
3460  ! iau, = Lower triangular matrix stored in compressed sparse row
3461  ! format.
3462  !
3463  ! On return:
3464  !-----------
3465  ! x = The solution of U x = y .
3466  !--------------------------------------------------------------------
3467  ! local variables
3468  !
3469  integer k, j
3470  real*8 t
3471  !-----------------------------------------------------------------------
3472  x(n) = y(n)
3473  do k = n-1,1,-1
3474  t = y(k)
3475  do j = iau(k), iau(k+1)-1
3476  t = t - au(j)*x(jau(j))
3477  end do
3478  x(k) = t
3479  end do
3480  !
3481  return
3482  !----------end-of-usol--------------------------------------------------
3483  !-----------------------------------------------------------------------

◆ usolc()

subroutine usolc ( integer  n,
real*8, dimension(*)  x,
real*8, dimension(*)  y,
real*8, dimension(*)  au,
integer, dimension(*)  jau,
integer, dimension(*)  iau 
)

Definition at line 3531 of file w3profsmd.F90.

3531  real*8 x(*), y(*), au(*)
3532  integer n, jau(*),iau(*)
3533  !-----------------------------------------------------------------------
3534  ! SOUVES U x = y ; where U = unit upper trang. CSC format
3535  !-----------------------------------------------------------------------
3536  ! solves a unit upper triangular system by standard (sequential )
3537  ! forward elimination - matrix stored in CSC format.
3538  !-----------------------------------------------------------------------
3539  !
3540  ! On entry:
3541  !----------
3542  ! n = integer. dimension of problem.
3543  ! y = real*8 array containg the right side.
3544  !
3545  ! au,
3546  ! jau,
3547  ! iau, = Uower triangular matrix stored in compressed sparse column
3548  ! format.
3549  !
3550  ! On return:
3551  !-----------
3552  ! x = The solution of U x = y.
3553  !-----------------------------------------------------------------------
3554  ! local variables
3555  !
3556  integer k, j
3557  real*8 t
3558  !-----------------------------------------------------------------------
3559  do k=1,n
3560  x(k) = y(k)
3561  end do
3562  do k = n,1,-1
3563  t = x(k)
3564  do j = iau(k), iau(k+1)-1
3565  x(jau(j)) = x(jau(j)) - t*au(j)
3566  end do
3567  end do
3568  !
3569  return
3570  !----------end-of-usolc-------------------------------------------------
3571  !-----------------------------------------------------------------------

◆ vbrmv()

subroutine vbrmv ( integer  nr,
integer  nc,
integer, dimension(nr+1)  ia,
integer, dimension(*)  ja,
integer, dimension(*)  ka,
real*8, dimension(*)  a,
integer, dimension(nr+1)  kvstr,
integer, dimension(*)  kvstc,
real*8, dimension(*)  x,
real*8, dimension(*)  b 
)

Definition at line 3161 of file w3profsmd.F90.

3161  !-----------------------------------------------------------------------
3162  integer nr, nc, ia(nr+1), ja(*), ka(*), kvstr(nr+1), kvstc(*)
3163  real*8 a(*), x(*), b(*)
3164  !-----------------------------------------------------------------------
3165  ! Sparse matrix-full vector product, in VBR format.
3166  !-----------------------------------------------------------------------
3167  ! On entry:
3168  !--------------
3169  ! nr, nc = number of block rows and columns in matrix A
3170  ! ia,ja,ka,a,kvstr,kvstc = matrix A in variable block row format
3171  ! x = multiplier vector in full format
3172  !
3173  ! On return:
3174  !---------------
3175  ! b = product of matrix A times vector x in full format
3176  !
3177  ! Algorithm:
3178  !---------------
3179  ! Perform multiplication by traversing a in order.
3180  !
3181  !-----------------------------------------------------------------------
3182  !-----local variables
3183  integer n, i, j, ii, jj, k, istart, istop
3184  real*8 xjj
3185  !---------------------------------
3186  n = kvstc(nc+1)-1
3187  do i = 1, n
3188  b(i) = 0.d0
3189  enddo
3190  !---------------------------------
3191  k = 1
3192  do i = 1, nr
3193  istart = kvstr(i)
3194  istop = kvstr(i+1)-1
3195  do j = ia(i), ia(i+1)-1
3196  do jj = kvstc(ja(j)), kvstc(ja(j)+1)-1
3197  xjj = x(jj)
3198  do ii = istart, istop
3199  b(ii) = b(ii) + xjj*a(k)
3200  k = k + 1
3201  enddo
3202  enddo
3203  enddo
3204  enddo
3205  !---------------------------------
3206  return
ddot
double precision function ddot(n, dx, dy)
Definition: w3profsmd.F90:4613
amux
subroutine amux(n, x, y, a, ja, ia)
Definition: w3profsmd.F90:2820
lusol
subroutine lusol(n, y, x, alu, jlu, ju)
Definition: w3profsmd.F90:3621
qsplit
subroutine qsplit(a, ind, n, ncut)
Definition: w3profsmd.F90:3686
stopbis
logical function stopbis(n, ipar, mvpi, fpar, r, delx, sx)
Definition: w3profsmd.F90:2465
lutsol
subroutine lutsol(n, y, x, alu, jlu, ju)
Definition: w3profsmd.F90:3649
tidycg
subroutine tidycg(n, ipar, fpar, sol, delx)
Definition: w3profsmd.F90:2523
atmux
subroutine atmux(n, x, y, a, ja, ia)
Definition: w3profsmd.F90:2908
dnrm2
double precision function dnrm2(N, X)
Definition: w3profsmd.F90:4499
brkdn
logical function brkdn(alpha, ipar)
Definition: w3profsmd.F90:2557
w3snl4md::diag
real, dimension(:,:), allocatable diag
Definition: w3snl4md.F90:195
bisinit
subroutine bisinit(ipar, fpar, wksize, dsc, lp, rp, wk)
Definition: w3profsmd.F90:2593
daxpy
subroutine daxpy(n, da, dx, incx, dy, incy)
Definition: w3profsmd.F90:4641