GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
dsolsy.f
Go to the documentation of this file.
1  SUBROUTINE dsolsy (WM, IWM, X, TEM)
2 C***BEGIN PROLOGUE DSOLSY
3 C***SUBSIDIARY
4 C***PURPOSE ODEPACK linear system solver.
5 C***TYPE DOUBLE PRECISION (SSOLSY-S, DSOLSY-D)
6 C***AUTHOR Hindmarsh, Alan C., (LLNL)
7 C***DESCRIPTION
8 C
9 C This routine manages the solution of the linear system arising from
10 C a chord iteration. It is called if MITER .ne. 0.
11 C If MITER is 1 or 2, it calls DGETRS to accomplish this.
12 C If MITER = 3 it updates the coefficient h*EL0 in the diagonal
13 C matrix, and then computes the solution.
14 C If MITER is 4 or 5, it calls DGBTRS.
15 C Communication with DSOLSY uses the following variables:
16 C WM = real work space containing the inverse diagonal matrix if
17 C MITER = 3 and the LU decomposition of the matrix otherwise.
18 C Storage of matrix elements starts at WM(3).
19 C WM also contains the following matrix-related data:
20 C WM(1) = SQRT(UROUND) (not used here),
21 C WM(2) = HL0, the previous value of h*EL0, used if MITER = 3.
22 C IWM = integer work space containing pivot information, starting at
23 C IWM(21), if MITER is 1, 2, 4, or 5. IWM also contains band
24 C parameters ML = IWM(1) and MU = IWM(2) if MITER is 4 or 5.
25 C X = the right-hand side vector on input, and the solution vector
26 C on output, of length N.
27 C TEM = vector of work space of length N, not used in this version.
28 C IERSL = output flag (in COMMON). IERSL = 0 if no trouble occurred.
29 C IERSL = 1 if a singular matrix arose with MITER = 3.
30 C This routine also uses the COMMON variables EL0, H, MITER, and N.
31 C
32 C***SEE ALSO DLSODE
33 C***ROUTINES CALLED DGBTRS, DGETRS
34 C***COMMON BLOCKS DLS001
35 C***REVISION HISTORY (YYMMDD)
36 C 791129 DATE WRITTEN
37 C 890501 Modified prologue to SLATEC/LDOC format. (FNF)
38 C 890503 Minor cosmetic changes. (FNF)
39 C 930809 Renamed to allow single/double precision versions. (ACH)
40 C 010418 Reduced size of Common block /DLS001/. (ACH)
41 C 031105 Restored 'own' variables to Common block /DLS001/, to
42 C enable interrupt/restart feature. (ACH)
43 C***END PROLOGUE DSOLSY
44 C**End
45  INTEGER IWM
46  DOUBLE PRECISION WM, X, TEM
47  dimension wm(*), iwm(*), x(*), tem(*)
48  INTEGER ILLIN, INIT, LYH, LEWT, LACOR, LSAVF, LWM, LIWM,
49  1 MXSTEP, MXHNIL, NHNIL, NTREP, NSLAST, NYH,
50  2 IALTH, IPUP, LMAX, MEO, NQNYH, NSLP
51  INTEGER ICF, IERPJ, IERSL, JCUR, JSTART, KFLAG, L, METH, MITER,
52  2 MAXORD, MAXCOR, MSBP, MXNCF, N, NQ, NST, NFE, NJE, NQU
53  DOUBLE PRECISION CONIT, CRATE, EL, ELCO, HOLD, RMAX, TESCO,
54  2 CCMAX, EL0, H, HMIN, HMXI, HU, RC, TN, UROUND
55  COMMON /dls001/ conit, crate, el(13), elco(13,12),
56  1 hold, rmax, tesco(3,12),
57  2 ccmax, el0, h, hmin, hmxi, hu, rc, tn, uround,
58  2 illin, init, lyh, lewt, lacor, lsavf, lwm, liwm,
59  3 mxstep, mxhnil, nhnil, ntrep, nslast, nyh,
60  3 ialth, ipup, lmax, meo, nqnyh, nslp,
61  4 icf, ierpj, iersl, jcur, jstart, kflag, l, meth, miter,
62  5 maxord, maxcor, msbp, mxncf, n, nq, nst, nfe, nje, nqu
63  INTEGER I, MEBAND, ML, MU
64  INTEGER INLPCK
65  DOUBLE PRECISION DI, HL0, PHL0, R
66 C
67 C***FIRST EXECUTABLE STATEMENT DSOLSY
68  iersl = 0
69  GO TO (100, 100, 300, 400, 400), miter
70  100 CALL dgetrs ( 'N', n, 1, wm(3), n, iwm(21), x, n, inlpck)
71  RETURN
72 C
73  300 phl0 = wm(2)
74  hl0 = h*el0
75  wm(2) = hl0
76  IF (hl0 .EQ. phl0) GO TO 330
77  r = hl0/phl0
78  DO 320 i = 1,n
79  di = 1.0d0 - r*(1.0d0 - 1.0d0/wm(i+2))
80  IF (abs(di) .EQ. 0.0d0) GO TO 390
81  320 wm(i+2) = 1.0d0/di
82  330 DO 340 i = 1,n
83  340 x(i) = wm(i+2)*x(i)
84  RETURN
85  390 iersl = 1
86  RETURN
87 C
88  400 ml = iwm(1)
89  mu = iwm(2)
90  meband = 2*ml + mu + 1
91  CALL dgbtrs ( 'N', n, ml, mu, 1, wm(3), meband, iwm(21), x, n,
92  * inlpck)
93  RETURN
94 C----------------------- END OF SUBROUTINE DSOLSY ----------------------
95  END
subroutine dsolsy(WM, IWM, X, TEM)
Definition: dsolsy.f:2