f2kodepack  Reference documentation for version 0.0
02_odepack_add_2.f90
Go to the documentation of this file.
1 ! ECK DGEFA
2 ! SUBROUTINE DGEFA (A, LDA, N, IPVT, INFO)
3 !***BEGIN PROLOGUE DGEFA
4 !***PURPOSE Factor a matrix using Gaussian elimination.
5 !***CATEGORY D2A1
6 !***TYPE DOUBLE PRECISION (SGEFA-S, DGEFA-D, CGEFA-C)
7 !***KEYWORDS GENERAL MATRIX, LINEAR ALGEBRA, LINPACK,
8 ! MATRIX FACTORIZATION
9 !***AUTHOR Moler, C. B., (U. of New Mexico)
10 !***DESCRIPTION
11 ! DGEFA factors a double precision matrix by Gaussian elimination.
12 ! DGEFA is usually called by DGECO, but it can be called
13 ! directly with a saving in time if RCOND is not needed.
14 ! (Time for DGECO) = (1 + 9/N)*(Time for DGEFA) .
15 ! On Entry
16 ! A DOUBLE PRECISION(LDA, N)
17 ! the matrix to be factored.
18 ! LDA INTEGER
19 ! the leading dimension of the array A .
20 ! N INTEGER
21 ! the order of the matrix A .
22 ! On Return
23 ! A an upper triangular matrix and the multipliers
24 ! which were used to obtain it.
25 ! The factorization can be written A = L*U where
26 ! L is a product of permutation and unit lower
27 ! triangular matrices and U is upper triangular.
28 ! IPVT INTEGER(N)
29 ! an integer vector of pivot indices.
30 ! INFO INTEGER
31 ! = 0 normal value.
32 ! = K if U(K,K) .EQ. 0.0 . This is not an error
33 ! condition for this subroutine, but it does
34 ! indicate that DGESL or DGEDI will divide by zero
35 ! if called. Use RCOND in DGECO for a reliable
36 ! indication of singularity.
37 !***REFERENCES J. J. Dongarra, J. R. Bunch, C. B. Moler, and G. W.
38 ! Stewart, LINPACK Users' Guide, SIAM, 1979.
39 !***ROUTINES CALLED DAXPY, DSCAL, IDAMAX
40 !***REVISION HISTORY (YYMMDD)
41 ! 780814 DATE WRITTEN
42 ! 890831 Modified array declarations. (WRB)
43 ! 890831 REVISION DATE from Version 3.2
44 ! 891214 Prologue converted to Version 4.0 format. (BAB)
45 ! 900326 Removed duplicate information from DESCRIPTION section.
46 ! (WRB)
47 ! 920501 Reformatted the REFERENCES section. (WRB)
48 !***END PROLOGUE DGEFA
49 ! INTEGER :: LDA,N,IPVT(*),INFO
50 ! DOUBLE PRECISION :: A(LDA,*)
51 ! DOUBLE PRECISION :: T
52 ! INTEGER :: IDAMAX,J,K,KP1,L,NM1
53 ! GAUSSIAN ELIMINATION WITH PARTIAL PIVOTING
54 !***FIRST EXECUTABLE STATEMENT DGEFA
55 ! INFO = 0
56 ! NM1 = N - 1
57 ! IF (NM1 < 1) GO TO 70
58 ! DO 60 K = 1, NM1
59 ! KP1 = K + 1
60 !
61 ! ! FIND L = PIVOT INDEX
62 !
63 ! L = IDAMAX(N-K+1,A(K,K),1) + K - 1
64 ! IPVT(K) = L
65 !
66 ! ! ZERO PIVOT IMPLIES THIS COLUMN ALREADY TRIANGULARIZED
67 !
68 ! IF (A(L,K) == 0.0D0) GO TO 40
69 !
70 ! ! INTERCHANGE IF NECESSARY
71 !
72 ! IF (L == K) GO TO 10
73 ! T = A(L,K)
74 ! A(L,K) = A(K,K)
75 ! A(K,K) = T
76 ! 10 CONTINUE
77 !
78 ! ! COMPUTE MULTIPLIERS
79 !
80 ! T = -1.0D0/A(K,K)
81 ! CALL DSCAL(N-K,T,A(K+1,K),1)
82 !
83 ! ! ROW ELIMINATION WITH COLUMN INDEXING
84 !
85 ! DO 30 J = KP1, N
86 ! T = A(L,J)
87 ! IF (L == K) GO TO 20
88 ! A(L,J) = A(K,J)
89 ! A(K,J) = T
90 ! 20 CONTINUE
91 ! CALL DAXPY(N-K,T,A(K+1,K),1,A(K+1,J),1)
92 ! 30 END DO
93 ! cycle
94 ! 40 CONTINUE
95 ! INFO = K
96 ! 60 END DO
97 ! 70 CONTINUE
98 ! IPVT(N) = N
99 ! IF (A(N,N) == 0.0D0) INFO = N
100 ! RETURN
101 ! END SUBROUTINE DGEFA
102 ! ECK DGESL
103 ! SUBROUTINE DGESL (A, LDA, N, IPVT, B, JOB)
104 !***BEGIN PROLOGUE DGESL
105 !***PURPOSE Solve the real system A*X=B or TRANS(A)*X=B using the
106 ! factors computed by DGECO or DGEFA.
107 !***CATEGORY D2A1
108 !***TYPE DOUBLE PRECISION (SGESL-S, DGESL-D, CGESL-C)
109 !***KEYWORDS LINEAR ALGEBRA, LINPACK, MATRIX, SOLVE
110 !***AUTHOR Moler, C. B., (U. of New Mexico)
111 !***DESCRIPTION
112 ! DGESL solves the double precision system
113 ! A * X = B or TRANS(A) * X = B
114 ! using the factors computed by DGECO or DGEFA.
115 ! On Entry
116 ! A DOUBLE PRECISION(LDA, N)
117 ! the output from DGECO or DGEFA.
118 ! LDA INTEGER
119 ! the leading dimension of the array A .
120 ! N INTEGER
121 ! the order of the matrix A .
122 ! IPVT INTEGER(N)
123 ! the pivot vector from DGECO or DGEFA.
124 ! B DOUBLE PRECISION(N)
125 ! the right hand side vector.
126 ! JOB INTEGER
127 ! = 0 to solve A*X = B ,
128 ! = nonzero to solve TRANS(A)*X = B where
129 ! TRANS(A) is the transpose.
130 ! On Return
131 ! B the solution vector X .
132 ! Error Condition
133 ! A division by zero will occur if the input factor contains a
134 ! zero on the diagonal. Technically this indicates singularity
135 ! but it is often caused by improper arguments or improper
136 ! setting of LDA . It will not occur if the subroutines are
137 ! called correctly and if DGECO has set RCOND .GT. 0.0
138 ! or DGEFA has set INFO .EQ. 0 .
139 ! To compute INVERSE(A) * C where C is a matrix
140 ! with P columns
141 ! CALL DGECO(A,LDA,N,IPVT,RCOND,Z)
142 ! IF (RCOND is too small) GO TO ...
143 ! DO 10 J = 1, P
144 ! CALL DGESL(A,LDA,N,IPVT,C(1,J),0)
145 ! 10 CONTINUE
146 !***REFERENCES J. J. Dongarra, J. R. Bunch, C. B. Moler, and G. W.
147 ! Stewart, LINPACK Users' Guide, SIAM, 1979.
148 !***ROUTINES CALLED DAXPY, DDOT
149 !***REVISION HISTORY (YYMMDD)
150 ! 780814 DATE WRITTEN
151 ! 890831 Modified array declarations. (WRB)
152 ! 890831 REVISION DATE from Version 3.2
153 ! 891214 Prologue converted to Version 4.0 format. (BAB)
154 ! 900326 Removed duplicate information from DESCRIPTION section.
155 ! (WRB)
156 ! 920501 Reformatted the REFERENCES section. (WRB)
157 !***END PROLOGUE DGESL
158 ! INTEGER :: LDA,N,IPVT(*),JOB
159 ! DOUBLE PRECISION :: A(LDA,*),B(*)
160 ! DOUBLE PRECISION :: DDOT,T
161 ! INTEGER :: K,KB,L,NM1
162 !***FIRST EXECUTABLE STATEMENT DGESL
163 ! NM1 = N - 1
164 ! IF (JOB /= 0) GO TO 50
165 ! JOB = 0 , SOLVE A * X = B
166 ! FIRST SOLVE L*Y = B
167 ! IF (NM1 < 1) GO TO 30
168 ! DO 20 K = 1, NM1
169 ! L = IPVT(K)
170 ! T = B(L)
171 ! IF (L == K) GO TO 10
172 ! B(L) = B(K)
173 ! B(K) = T
174 ! 10 CONTINUE
175 ! CALL DAXPY(N-K,T,A(K+1,K),1,B(K+1),1)
176 ! 20 END DO
177 ! 30 CONTINUE
178 ! NOW SOLVE U*X = Y
179 ! DO 40 KB = 1, N
180 ! K = N + 1 - KB
181 ! B(K) = B(K)/A(K,K)
182 ! T = -B(K)
183 ! CALL DAXPY(K-1,T,A(1,K),1,B(1),1)
184 ! 40 END DO
185 ! GO TO 100
186 ! 50 CONTINUE
187 ! JOB = NONZERO, SOLVE TRANS(A) * X = B
188 ! FIRST SOLVE TRANS(U)*Y = B
189 ! DO 60 K = 1, N
190 ! T = DDOT(K-1,A(1,K),1,B(1),1)
191 ! B(K) = (B(K) - T)/A(K,K)
192 ! 60 END DO
193 ! NOW SOLVE TRANS(L)*X = Y
194 ! IF (NM1 < 1) GO TO 90
195 ! DO 80 KB = 1, NM1
196 ! K = N - KB
197 ! B(K) = B(K) + DDOT(N-K,A(K+1,K),1,B(K+1),1)
198 ! L = IPVT(K)
199 ! IF (L == K) cycle
200 ! T = B(L)
201 ! B(L) = B(K)
202 ! B(K) = T
203 ! 80 END DO
204 ! 90 CONTINUE
205 ! 100 CONTINUE
206 ! RETURN
207 ! END SUBROUTINE DGESL
208 ! ECK DGBFA
209 ! SUBROUTINE DGBFA (ABD, LDA, N, ML, MU, IPVT, INFO)
210 !***BEGIN PROLOGUE DGBFA
211 !***PURPOSE Factor a band matrix using Gaussian elimination.
212 !***CATEGORY D2A2
213 !***TYPE DOUBLE PRECISION (SGBFA-S, DGBFA-D, CGBFA-C)
214 !***KEYWORDS BANDED, LINEAR ALGEBRA, LINPACK, MATRIX FACTORIZATION
215 !***AUTHOR Moler, C. B., (U. of New Mexico)
216 !***DESCRIPTION
217 ! DGBFA factors a double precision band matrix by elimination.
218 ! DGBFA is usually called by DGBCO, but it can be called
219 ! directly with a saving in time if RCOND is not needed.
220 ! On Entry
221 ! ABD DOUBLE PRECISION(LDA, N)
222 ! contains the matrix in band storage. The columns
223 ! of the matrix are stored in the columns of ABD and
224 ! the diagonals of the matrix are stored in rows
225 ! ML+1 through 2*ML+MU+1 of ABD .
226 ! See the comments below for details.
227 ! LDA INTEGER
228 ! the leading dimension of the array ABD .
229 ! LDA must be .GE. 2*ML + MU + 1 .
230 ! N INTEGER
231 ! the order of the original matrix.
232 ! ML INTEGER
233 ! number of diagonals below the main diagonal.
234 ! 0 .LE. ML .LT. N .
235 ! MU INTEGER
236 ! number of diagonals above the main diagonal.
237 ! 0 .LE. MU .LT. N .
238 ! More efficient if ML .LE. MU .
239 ! On Return
240 ! ABD an upper triangular matrix in band storage and
241 ! the multipliers which were used to obtain it.
242 ! The factorization can be written A = L*U where
243 ! L is a product of permutation and unit lower
244 ! triangular matrices and U is upper triangular.
245 ! IPVT INTEGER(N)
246 ! an integer vector of pivot indices.
247 ! INFO INTEGER
248 ! = 0 normal value.
249 ! = K if U(K,K) .EQ. 0.0 . This is not an error
250 ! condition for this subroutine, but it does
251 ! indicate that DGBSL will divide by zero if
252 ! called. Use RCOND in DGBCO for a reliable
253 ! indication of singularity.
254 ! Band Storage
255 ! If A is a band matrix, the following program segment
256 ! will set up the input.
257 ! ML = (band width below the diagonal)
258 ! MU = (band width above the diagonal)
259 ! M = ML + MU + 1
260 ! DO 20 J = 1, N
261 ! I1 = MAX(1, J-MU)
262 ! I2 = MIN(N, J+ML)
263 ! DO 10 I = I1, I2
264 ! K = I - J + M
265 ! ABD(K,J) = A(I,J)
266 ! 10 CONTINUE
267 ! 20 CONTINUE
268 ! This uses rows ML+1 through 2*ML+MU+1 of ABD .
269 ! In addition, the first ML rows in ABD are used for
270 ! elements generated during the triangularization.
271 ! The total number of rows needed in ABD is 2*ML+MU+1 .
272 ! The ML+MU by ML+MU upper left triangle and the
273 ! ML by ML lower right triangle are not referenced.
274 !***REFERENCES J. J. Dongarra, J. R. Bunch, C. B. Moler, and G. W.
275 ! Stewart, LINPACK Users' Guide, SIAM, 1979.
276 !***ROUTINES CALLED DAXPY, DSCAL, IDAMAX
277 !***REVISION HISTORY (YYMMDD)
278 ! 780814 DATE WRITTEN
279 ! 890531 Changed all specific intrinsics to generic. (WRB)
280 ! 890831 Modified array declarations. (WRB)
281 ! 890831 REVISION DATE from Version 3.2
282 ! 891214 Prologue converted to Version 4.0 format. (BAB)
283 ! 900326 Removed duplicate information from DESCRIPTION section.
284 ! (WRB)
285 ! 920501 Reformatted the REFERENCES section. (WRB)
286 !***END PROLOGUE DGBFA
287 ! INTEGER :: LDA,N,ML,MU,IPVT(*),INFO
288 ! DOUBLE PRECISION :: ABD(LDA,*)
289 ! DOUBLE PRECISION :: T
290 ! INTEGER :: I,IDAMAX,I0,J,JU,JZ,J0,J1,K,KP1,L,LM,M,MM,NM1
291 !***FIRST EXECUTABLE STATEMENT DGBFA
292 ! M = ML + MU + 1
293 ! INFO = 0
294 ! ZERO INITIAL FILL-IN COLUMNS
295 ! J0 = MU + 2
296 ! J1 = MIN(N,M) - 1
297 ! IF (J1 < J0) GO TO 30
298 ! DO 20 JZ = J0, J1
299 ! I0 = M + 1 - JZ
300 ! DO 10 I = I0, ML
301 ! ABD(I,JZ) = 0.0D0
302 ! 10 END DO
303 ! 20 END DO
304 ! 30 CONTINUE
305 ! JZ = J1
306 ! JU = 0
307 ! GAUSSIAN ELIMINATION WITH PARTIAL PIVOTING
308 ! NM1 = N - 1
309 ! IF (NM1 < 1) GO TO 130
310 ! DO 120 K = 1, NM1
311 ! KP1 = K + 1
312 !
313 ! ! ZERO NEXT FILL-IN COLUMN
314 !
315 ! JZ = JZ + 1
316 ! IF (JZ > N) GO TO 50
317 ! IF (ML < 1) GO TO 50
318 ! DO 40 I = 1, ML
319 ! ABD(I,JZ) = 0.0D0
320 ! 40 END DO
321 ! 50 CONTINUE
322 !
323 ! ! FIND L = PIVOT INDEX
324 !
325 ! LM = MIN(ML,N-K)
326 ! L = IDAMAX(LM+1,ABD(M,K),1) + M - 1
327 ! IPVT(K) = L + K - M
328 !
329 ! ! ZERO PIVOT IMPLIES THIS COLUMN ALREADY TRIANGULARIZED
330 !
331 ! IF (ABD(L,K) == 0.0D0) GO TO 100
332 !
333 ! ! INTERCHANGE IF NECESSARY
334 !
335 ! IF (L == M) GO TO 60
336 ! T = ABD(L,K)
337 ! ABD(L,K) = ABD(M,K)
338 ! ABD(M,K) = T
339 ! 60 CONTINUE
340 !
341 ! ! COMPUTE MULTIPLIERS
342 !
343 ! T = -1.0D0/ABD(M,K)
344 ! CALL DSCAL(LM,T,ABD(M+1,K),1)
345 !
346 ! ! ROW ELIMINATION WITH COLUMN INDEXING
347 !
348 ! JU = MIN(MAX(JU,MU+IPVT(K)),N)
349 ! MM = M
350 ! IF (JU < KP1) GO TO 90
351 ! DO 80 J = KP1, JU
352 ! L = L - 1
353 ! MM = MM - 1
354 ! T = ABD(L,J)
355 ! IF (L == MM) GO TO 70
356 ! ABD(L,J) = ABD(MM,J)
357 ! ABD(MM,J) = T
358 ! 70 CONTINUE
359 ! CALL DAXPY(LM,T,ABD(M+1,K),1,ABD(MM+1,J),1)
360 ! 80 END DO
361 ! 90 CONTINUE
362 ! cycle
363 ! 100 CONTINUE
364 ! INFO = K
365 ! 120 END DO
366 ! 130 CONTINUE
367 ! IPVT(N) = N
368 ! IF (ABD(M,N) == 0.0D0) INFO = N
369 ! RETURN
370 ! END SUBROUTINE DGBFA
371 ! ECK DGBSL
372 ! SUBROUTINE DGBSL (ABD, LDA, N, ML, MU, IPVT, B, JOB)
373 !***BEGIN PROLOGUE DGBSL
374 !***PURPOSE Solve the real band system A*X=B or TRANS(A)*X=B using
375 ! the factors computed by DGBCO or DGBFA.
376 !***CATEGORY D2A2
377 !***TYPE DOUBLE PRECISION (SGBSL-S, DGBSL-D, CGBSL-C)
378 !***KEYWORDS BANDED, LINEAR ALGEBRA, LINPACK, MATRIX, SOLVE
379 !***AUTHOR Moler, C. B., (U. of New Mexico)
380 !***DESCRIPTION
381 ! DGBSL solves the double precision band system
382 ! A * X = B or TRANS(A) * X = B
383 ! using the factors computed by DGBCO or DGBFA.
384 ! On Entry
385 ! ABD DOUBLE PRECISION(LDA, N)
386 ! the output from DGBCO or DGBFA.
387 ! LDA INTEGER
388 ! the leading dimension of the array ABD .
389 ! N INTEGER
390 ! the order of the original matrix.
391 ! ML INTEGER
392 ! number of diagonals below the main diagonal.
393 ! MU INTEGER
394 ! number of diagonals above the main diagonal.
395 ! IPVT INTEGER(N)
396 ! the pivot vector from DGBCO or DGBFA.
397 ! B DOUBLE PRECISION(N)
398 ! the right hand side vector.
399 ! JOB INTEGER
400 ! = 0 to solve A*X = B ,
401 ! = nonzero to solve TRANS(A)*X = B , where
402 ! TRANS(A) is the transpose.
403 ! On Return
404 ! B the solution vector X .
405 ! Error Condition
406 ! A division by zero will occur if the input factor contains a
407 ! zero on the diagonal. Technically this indicates singularity
408 ! but it is often caused by improper arguments or improper
409 ! setting of LDA . It will not occur if the subroutines are
410 ! called correctly and if DGBCO has set RCOND .GT. 0.0
411 ! or DGBFA has set INFO .EQ. 0 .
412 ! To compute INVERSE(A) * C where C is a matrix
413 ! with P columns
414 ! CALL DGBCO(ABD,LDA,N,ML,MU,IPVT,RCOND,Z)
415 ! IF (RCOND is too small) GO TO ...
416 ! DO 10 J = 1, P
417 ! CALL DGBSL(ABD,LDA,N,ML,MU,IPVT,C(1,J),0)
418 ! 10 CONTINUE
419 !***REFERENCES J. J. Dongarra, J. R. Bunch, C. B. Moler, and G. W.
420 ! Stewart, LINPACK Users' Guide, SIAM, 1979.
421 !***ROUTINES CALLED DAXPY, DDOT
422 !***REVISION HISTORY (YYMMDD)
423 ! 780814 DATE WRITTEN
424 ! 890531 Changed all specific intrinsics to generic. (WRB)
425 ! 890831 Modified array declarations. (WRB)
426 ! 890831 REVISION DATE from Version 3.2
427 ! 891214 Prologue converted to Version 4.0 format. (BAB)
428 ! 900326 Removed duplicate information from DESCRIPTION section.
429 ! (WRB)
430 ! 920501 Reformatted the REFERENCES section. (WRB)
431 !***END PROLOGUE DGBSL
432 ! INTEGER :: LDA,N,ML,MU,IPVT(*),JOB
433 ! DOUBLE PRECISION :: ABD(LDA,*),B(*)
434 ! DOUBLE PRECISION :: DDOT,T
435 ! INTEGER :: K,KB,L,LA,LB,LM,M,NM1
436 !***FIRST EXECUTABLE STATEMENT DGBSL
437 ! M = MU + ML + 1
438 ! NM1 = N - 1
439 ! IF (JOB /= 0) GO TO 50
440 ! JOB = 0 , SOLVE A * X = B
441 ! FIRST SOLVE L*Y = B
442 ! IF (ML == 0) GO TO 30
443 ! IF (NM1 < 1) GO TO 30
444 ! DO 20 K = 1, NM1
445 ! LM = MIN(ML,N-K)
446 ! L = IPVT(K)
447 ! T = B(L)
448 ! IF (L == K) GO TO 10
449 ! B(L) = B(K)
450 ! B(K) = T
451 ! 10 CONTINUE
452 ! CALL DAXPY(LM,T,ABD(M+1,K),1,B(K+1),1)
453 ! 20 END DO
454 ! 30 CONTINUE
455 ! NOW SOLVE U*X = Y
456 ! DO 40 KB = 1, N
457 ! K = N + 1 - KB
458 ! B(K) = B(K)/ABD(M,K)
459 ! LM = MIN(K,M) - 1
460 ! LA = M - LM
461 ! LB = K - LM
462 ! T = -B(K)
463 ! CALL DAXPY(LM,T,ABD(LA,K),1,B(LB),1)
464 ! 40 END DO
465 ! GO TO 100
466 ! 50 CONTINUE
467 ! JOB = NONZERO, SOLVE TRANS(A) * X = B
468 ! FIRST SOLVE TRANS(U)*Y = B
469 ! DO 60 K = 1, N
470 ! LM = MIN(K,M) - 1
471 ! LA = M - LM
472 ! LB = K - LM
473 ! T = DDOT(LM,ABD(LA,K),1,B(LB),1)
474 ! B(K) = (B(K) - T)/ABD(M,K)
475 ! 60 END DO
476 ! NOW SOLVE TRANS(L)*X = Y
477 ! IF (ML == 0) GO TO 90
478 ! IF (NM1 < 1) GO TO 90
479 ! DO 80 KB = 1, NM1
480 ! K = N - KB
481 ! LM = MIN(ML,N-K)
482 ! B(K) = B(K) + DDOT(LM,ABD(M+1,K),1,B(K+1),1)
483 ! L = IPVT(K)
484 ! IF (L == K) cycle
485 ! T = B(L)
486 ! B(L) = B(K)
487 ! B(K) = T
488 ! 80 END DO
489 ! 90 CONTINUE
490 ! 100 CONTINUE
491 ! RETURN
492 ! END SUBROUTINE DGBSL
493 ! ECK DAXPY
494 ! SUBROUTINE DAXPY (N, DA, DX, INCX, DY, INCY)
495 !***BEGIN PROLOGUE DAXPY
496 !***PURPOSE Compute a constant times a vector plus a vector.
497 !***CATEGORY D1A7
498 !***TYPE DOUBLE PRECISION (SAXPY-S, DAXPY-D, CAXPY-C)
499 !***KEYWORDS BLAS, LINEAR ALGEBRA, TRIAD, VECTOR
500 !***AUTHOR Lawson, C. L., (JPL)
501 ! Hanson, R. J., (SNLA)
502 ! Kincaid, D. R., (U. of Texas)
503 ! Krogh, F. T., (JPL)
504 !***DESCRIPTION
505 ! B L A S Subprogram
506 ! Description of Parameters
507 ! --Input--
508 ! N number of elements in input vector(s)
509 ! DA double precision scalar multiplier
510 ! DX double precision vector with N elements
511 ! INCX storage spacing between elements of DX
512 ! DY double precision vector with N elements
513 ! INCY storage spacing between elements of DY
514 ! --Output--
515 ! DY double precision result (unchanged if N .LE. 0)
516 ! Overwrite double precision DY with double precision DA*DX + DY.
517 ! For I = 0 to N-1, replace DY(LY+I*INCY) with DA*DX(LX+I*INCX) +
518 ! DY(LY+I*INCY),
519 ! where LX = 1 if INCX .GE. 0, else LX = 1+(1-N)*INCX, and LY is
520 ! defined in a similar way using INCY.
521 !***REFERENCES C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.
522 ! Krogh, Basic linear algebra subprograms for Fortran
523 ! usage, Algorithm No. 539, Transactions on Mathematical
524 ! Software 5, 3 (September 1979), pp. 308-323.
525 !***ROUTINES CALLED (NONE)
526 !***REVISION HISTORY (YYMMDD)
527 ! 791001 DATE WRITTEN
528 ! 890831 Modified array declarations. (WRB)
529 ! 890831 REVISION DATE from Version 3.2
530 ! 891214 Prologue converted to Version 4.0 format. (BAB)
531 ! 920310 Corrected definition of LX in DESCRIPTION. (WRB)
532 ! 920501 Reformatted the REFERENCES section. (WRB)
533 !***END PROLOGUE DAXPY
534 ! DOUBLE PRECISION :: DX(*), DY(*), DA
535 !***FIRST EXECUTABLE STATEMENT DAXPY
536 ! IF (N <= 0 .OR. DA == 0.0D0) RETURN
537 ! IF (INCX == INCY) IF (INCX-1) 5,20,60
538 ! Code for unequal or nonpositive increments.
539 ! 5 IX = 1
540 ! IY = 1
541 ! IF (INCX < 0) IX = (-N+1)*INCX + 1
542 ! IF (INCY < 0) IY = (-N+1)*INCY + 1
543 ! DO 10 I = 1,N
544 ! DY(IY) = DY(IY) + DA*DX(IX)
545 ! IX = IX + INCX
546 ! IY = IY + INCY
547 ! 10 END DO
548 ! RETURN
549 ! Code for both increments equal to 1.
550 ! Clean-up loop so remaining vector length is a multiple of 4.
551 ! 20 M = MOD(N,4)
552 ! IF (M == 0) GO TO 40
553 ! DO 30 I = 1,M
554 ! DY(I) = DY(I) + DA*DX(I)
555 ! 30 END DO
556 ! IF (N < 4) RETURN
557 ! 40 MP1 = M + 1
558 ! DO 50 I = MP1,N,4
559 ! DY(I) = DY(I) + DA*DX(I)
560 ! DY(I+1) = DY(I+1) + DA*DX(I+1)
561 ! DY(I+2) = DY(I+2) + DA*DX(I+2)
562 ! DY(I+3) = DY(I+3) + DA*DX(I+3)
563 ! 50 END DO
564 ! RETURN
565 ! Code for equal, positive, non-unit increments.
566 ! 60 NS = N*INCX
567 ! DO 70 I = 1,NS,INCX
568 ! DY(I) = DA*DX(I) + DY(I)
569 ! 70 END DO
570 ! RETURN
571 ! END SUBROUTINE DAXPY
572 ! ECK DCOPY
573 ! SUBROUTINE DCOPY (N, DX, INCX, DY, INCY)
574 !***BEGIN PROLOGUE DCOPY
575 !***PURPOSE Copy a vector.
576 !***CATEGORY D1A5
577 !***TYPE DOUBLE PRECISION (SCOPY-S, DCOPY-D, CCOPY-C, ICOPY-I)
578 !***KEYWORDS BLAS, COPY, LINEAR ALGEBRA, VECTOR
579 !***AUTHOR Lawson, C. L., (JPL)
580 ! Hanson, R. J., (SNLA)
581 ! Kincaid, D. R., (U. of Texas)
582 ! Krogh, F. T., (JPL)
583 !***DESCRIPTION
584 ! B L A S Subprogram
585 ! Description of Parameters
586 ! --Input--
587 ! N number of elements in input vector(s)
588 ! DX double precision vector with N elements
589 ! INCX storage spacing between elements of DX
590 ! DY double precision vector with N elements
591 ! INCY storage spacing between elements of DY
592 ! --Output--
593 ! DY copy of vector DX (unchanged if N .LE. 0)
594 ! Copy double precision DX to double precision DY.
595 ! For I = 0 to N-1, copy DX(LX+I*INCX) to DY(LY+I*INCY),
596 ! where LX = 1 if INCX .GE. 0, else LX = 1+(1-N)*INCX, and LY is
597 ! defined in a similar way using INCY.
598 !***REFERENCES C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.
599 ! Krogh, Basic linear algebra subprograms for Fortran
600 ! usage, Algorithm No. 539, Transactions on Mathematical
601 ! Software 5, 3 (September 1979), pp. 308-323.
602 !***ROUTINES CALLED (NONE)
603 !***REVISION HISTORY (YYMMDD)
604 ! 791001 DATE WRITTEN
605 ! 890831 Modified array declarations. (WRB)
606 ! 890831 REVISION DATE from Version 3.2
607 ! 891214 Prologue converted to Version 4.0 format. (BAB)
608 ! 920310 Corrected definition of LX in DESCRIPTION. (WRB)
609 ! 920501 Reformatted the REFERENCES section. (WRB)
610 !***END PROLOGUE DCOPY
611 ! DOUBLE PRECISION :: DX(*), DY(*)
612 !***FIRST EXECUTABLE STATEMENT DCOPY
613 ! IF (N <= 0) RETURN
614 ! IF (INCX == INCY) IF (INCX-1) 5,20,60
615 ! Code for unequal or nonpositive increments.
616 ! 5 IX = 1
617 ! IY = 1
618 ! IF (INCX < 0) IX = (-N+1)*INCX + 1
619 ! IF (INCY < 0) IY = (-N+1)*INCY + 1
620 ! DO 10 I = 1,N
621 ! DY(IY) = DX(IX)
622 ! IX = IX + INCX
623 ! IY = IY + INCY
624 ! 10 END DO
625 ! RETURN
626 ! Code for both increments equal to 1.
627 ! Clean-up loop so remaining vector length is a multiple of 7.
628 ! 20 M = MOD(N,7)
629 ! IF (M == 0) GO TO 40
630 ! DO 30 I = 1,M
631 ! DY(I) = DX(I)
632 ! 30 END DO
633 ! IF (N < 7) RETURN
634 ! 40 MP1 = M + 1
635 ! DO 50 I = MP1,N,7
636 ! DY(I) = DX(I)
637 ! DY(I+1) = DX(I+1)
638 ! DY(I+2) = DX(I+2)
639 ! DY(I+3) = DX(I+3)
640 ! DY(I+4) = DX(I+4)
641 ! DY(I+5) = DX(I+5)
642 ! DY(I+6) = DX(I+6)
643 ! 50 END DO
644 ! RETURN
645 ! Code for equal, positive, non-unit increments.
646 ! 60 NS = N*INCX
647 ! DO 70 I = 1,NS,INCX
648 ! DY(I) = DX(I)
649 ! 70 END DO
650 ! RETURN
651 ! END SUBROUTINE DCOPY
652 ! ECK DDOT
653 ! DOUBLE PRECISION :: FUNCTION DDOT (N, DX, INCX, DY, INCY)
654 !***BEGIN PROLOGUE DDOT
655 !***PURPOSE Compute the inner product of two vectors.
656 !***CATEGORY D1A4
657 !***TYPE DOUBLE PRECISION (SDOT-S, DDOT-D, CDOTU-C)
658 !***KEYWORDS BLAS, INNER PRODUCT, LINEAR ALGEBRA, VECTOR
659 !***AUTHOR Lawson, C. L., (JPL)
660 ! Hanson, R. J., (SNLA)
661 ! Kincaid, D. R., (U. of Texas)
662 ! Krogh, F. T., (JPL)
663 !***DESCRIPTION
664 ! B L A S Subprogram
665 ! Description of Parameters
666 ! --Input--
667 ! N number of elements in input vector(s)
668 ! DX double precision vector with N elements
669 ! INCX storage spacing between elements of DX
670 ! DY double precision vector with N elements
671 ! INCY storage spacing between elements of DY
672 ! --Output--
673 ! DDOT double precision dot product (zero if N .LE. 0)
674 ! Returns the dot product of double precision DX and DY.
675 ! DDOT = sum for I = 0 to N-1 of DX(LX+I*INCX) * DY(LY+I*INCY),
676 ! where LX = 1 if INCX .GE. 0, else LX = 1+(1-N)*INCX, and LY is
677 ! defined in a similar way using INCY.
678 !***REFERENCES C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.
679 ! Krogh, Basic linear algebra subprograms for Fortran
680 ! usage, Algorithm No. 539, Transactions on Mathematical
681 ! Software 5, 3 (September 1979), pp. 308-323.
682 !***ROUTINES CALLED (NONE)
683 !***REVISION HISTORY (YYMMDD)
684 ! 791001 DATE WRITTEN
685 ! 890831 Modified array declarations. (WRB)
686 ! 890831 REVISION DATE from Version 3.2
687 ! 891214 Prologue converted to Version 4.0 format. (BAB)
688 ! 920310 Corrected definition of LX in DESCRIPTION. (WRB)
689 ! 920501 Reformatted the REFERENCES section. (WRB)
690 !***END PROLOGUE DDOT
691 ! DOUBLE PRECISION :: DX(*), DY(*)
692 !***FIRST EXECUTABLE STATEMENT DDOT
693 ! DDOT = 0.0D0
694 ! IF (N <= 0) RETURN
695 ! IF (INCX == INCY) IF (INCX-1) 5,20,60
696 ! Code for unequal or nonpositive increments.
697 ! 5 IX = 1
698 ! IY = 1
699 ! IF (INCX < 0) IX = (-N+1)*INCX + 1
700 ! IF (INCY < 0) IY = (-N+1)*INCY + 1
701 ! DO 10 I = 1,N
702 ! DDOT = DDOT + DX(IX)*DY(IY)
703 ! IX = IX + INCX
704 ! IY = IY + INCY
705 ! 10 END DO
706 ! RETURN
707 ! Code for both increments equal to 1.
708 ! Clean-up loop so remaining vector length is a multiple of 5.
709 ! 20 M = MOD(N,5)
710 ! IF (M == 0) GO TO 40
711 ! DO 30 I = 1,M
712 ! DDOT = DDOT + DX(I)*DY(I)
713 ! 30 END DO
714 ! IF (N < 5) RETURN
715 ! 40 MP1 = M + 1
716 ! DO 50 I = MP1,N,5
717 ! DDOT = DDOT + DX(I)*DY(I) + DX(I+1)*DY(I+1) + DX(I+2)*DY(I+2) + &
718 ! DX(I+3)*DY(I+3) + DX(I+4)*DY(I+4)
719 ! 50 END DO
720 ! RETURN
721 ! Code for equal, positive, non-unit increments.
722 ! 60 NS = N*INCX
723 ! DO 70 I = 1,NS,INCX
724 ! DDOT = DDOT + DX(I)*DY(I)
725 ! 70 END DO
726 ! RETURN
727 ! END PROGRAM
728 ! ECK DNRM2
729 ! DOUBLE PRECISION :: FUNCTION DNRM2 (N, DX, INCX)
730 !***BEGIN PROLOGUE DNRM2
731 !***PURPOSE Compute the Euclidean length (L2 norm) of a vector.
732 !***CATEGORY D1A3B
733 !***TYPE DOUBLE PRECISION (SNRM2-S, DNRM2-D, SCNRM2-C)
734 !***KEYWORDS BLAS, EUCLIDEAN LENGTH, EUCLIDEAN NORM, L2,
735 ! LINEAR ALGEBRA, UNITARY, VECTOR
736 !***AUTHOR Lawson, C. L., (JPL)
737 ! Hanson, R. J., (SNLA)
738 ! Kincaid, D. R., (U. of Texas)
739 ! Krogh, F. T., (JPL)
740 !***DESCRIPTION
741 ! B L A S Subprogram
742 ! Description of parameters
743 ! --Input--
744 ! N number of elements in input vector(s)
745 ! DX double precision vector with N elements
746 ! INCX storage spacing between elements of DX
747 ! --Output--
748 ! DNRM2 double precision result (zero if N .LE. 0)
749 ! Euclidean norm of the N-vector stored in DX with storage
750 ! increment INCX.
751 ! If N .LE. 0, return with result = 0.
752 ! If N .GE. 1, then INCX must be .GE. 1
753 ! Four phase method using two built-in constants that are
754 ! hopefully applicable to all machines.
755 ! CUTLO = maximum of SQRT(U/EPS) over all known machines.
756 ! CUTHI = minimum of SQRT(V) over all known machines.
757 ! where
758 ! EPS = smallest no. such that EPS + 1. .GT. 1.
759 ! U = smallest positive no. (underflow limit)
760 ! V = largest no. (overflow limit)
761 ! Brief outline of algorithm.
762 ! Phase 1 scans zero components.
763 ! move to phase 2 when a component is nonzero and .LE. CUTLO
764 ! move to phase 3 when a component is .GT. CUTLO
765 ! move to phase 4 when a component is .GE. CUTHI/M
766 ! where M = N for X() real and M = 2*N for complex.
767 ! Values for CUTLO and CUTHI.
768 ! From the environmental parameters listed in the IMSL converter
769 ! document the limiting values are as follows:
770 ! CUTLO, S.P. U/EPS = 2**(-102) for Honeywell. Close seconds are
771 ! Univac and DEC at 2**(-103)
772 ! Thus CUTLO = 2**(-51) = 4.44089E-16
773 ! CUTHI, S.P. V = 2**127 for Univac, Honeywell, and DEC.
774 ! Thus CUTHI = 2**(63.5) = 1.30438E19
775 ! CUTLO, D.P. U/EPS = 2**(-67) for Honeywell and DEC.
776 ! Thus CUTLO = 2**(-33.5) = 8.23181D-11
777 ! CUTHI, D.P. same as S.P. CUTHI = 1.30438D19
778 ! DATA CUTLO, CUTHI /8.232D-11, 1.304D19/
779 ! DATA CUTLO, CUTHI /4.441E-16, 1.304E19/
780 !***REFERENCES C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.
781 ! Krogh, Basic linear algebra subprograms for Fortran
782 ! usage, Algorithm No. 539, Transactions on Mathematical
783 ! Software 5, 3 (September 1979), pp. 308-323.
784 !***ROUTINES CALLED (NONE)
785 !***REVISION HISTORY (YYMMDD)
786 ! 791001 DATE WRITTEN
787 ! 890531 Changed all specific intrinsics to generic. (WRB)
788 ! 890831 Modified array declarations. (WRB)
789 ! 890831 REVISION DATE from Version 3.2
790 ! 891214 Prologue converted to Version 4.0 format. (BAB)
791 ! 920501 Reformatted the REFERENCES section. (WRB)
792 !***END PROLOGUE DNRM2
793 ! INTEGER :: NEXT
794 ! DOUBLE PRECISION :: DX(*), CUTLO, CUTHI, HITEST, SUM, XMAX, ZERO, &
795 ! ONE
796 ! SAVE CUTLO, CUTHI, ZERO, ONE
797 ! DATA ZERO, ONE /0.0D0, 1.0D0/
798 ! DATA CUTLO, CUTHI /8.232D-11, 1.304D19/
799 !***FIRST EXECUTABLE STATEMENT DNRM2
800 ! IF (N > 0) GO TO 10
801 ! DNRM2 = ZERO
802 ! GO TO 300
803 ! 10 ASSIGN 30 TO NEXT
804 ! SUM = ZERO
805 ! NN = N * INCX
806 ! BEGIN MAIN LOOP
807 ! I = 1
808 ! 20 GO TO NEXT,(30, 50, 70, 110)
809 ! 30 IF (ABS(DX(I)) > CUTLO) GO TO 85
810 ! ASSIGN 50 TO NEXT
811 ! XMAX = ZERO
812 ! PHASE 1. SUM IS ZERO
813 ! 50 IF (DX(I) == ZERO) GO TO 200
814 ! IF (ABS(DX(I)) > CUTLO) GO TO 85
815 ! PREPARE FOR PHASE 2.
816 ! ASSIGN 70 TO NEXT
817 ! GO TO 105
818 ! PREPARE FOR PHASE 4.
819 ! 100 I = J
820 ! ASSIGN 110 TO NEXT
821 ! SUM = (SUM / DX(I)) / DX(I)
822 ! 105 XMAX = ABS(DX(I))
823 ! GO TO 115
824 ! PHASE 2. SUM IS SMALL.
825 ! SCALE TO AVOID DESTRUCTIVE UNDERFLOW.
826 ! 70 IF (ABS(DX(I)) > CUTLO) GO TO 75
827 ! COMMON CODE FOR PHASES 2 AND 4.
828 ! IN PHASE 4 SUM IS LARGE. SCALE TO AVOID OVERFLOW.
829 ! 110 IF (ABS(DX(I)) <= XMAX) GO TO 115
830 ! SUM = ONE + SUM * (XMAX / DX(I))**2
831 ! XMAX = ABS(DX(I))
832 ! GO TO 200
833 ! 115 SUM = SUM + (DX(I)/XMAX)**2
834 ! GO TO 200
835 ! PREPARE FOR PHASE 3.
836 ! 75 SUM = (SUM * XMAX) * XMAX
837 ! FOR REAL OR D.P. SET HITEST = CUTHI/N
838 ! FOR COMPLEX SET HITEST = CUTHI/(2*N)
839 ! 85 HITEST = CUTHI / N
840 ! PHASE 3. SUM IS MID-RANGE. NO SCALING.
841 ! DO 95 J = I,NN,INCX
842 ! IF (ABS(DX(J)) >= HITEST) GO TO 100
843 ! SUM = SUM + DX(J)**2
844 ! 95 END DO
845 ! DNRM2 = SQRT(SUM)
846 ! GO TO 300
847 ! 200 CONTINUE
848 ! I = I + INCX
849 ! IF (I <= NN) GO TO 20
850 ! END OF MAIN LOOP.
851 ! COMPUTE SQUARE ROOT AND ADJUST FOR SCALING.
852 ! DNRM2 = XMAX * SQRT(SUM)
853 ! 300 CONTINUE
854 ! RETURN
855 ! END PROGRAM
856 ! ECK DSCAL
857 ! SUBROUTINE DSCAL (N, DA, DX, INCX)
858 !***BEGIN PROLOGUE DSCAL
859 !***PURPOSE Multiply a vector by a constant.
860 !***CATEGORY D1A6
861 !***TYPE DOUBLE PRECISION (SSCAL-S, DSCAL-D, CSCAL-C)
862 !***KEYWORDS BLAS, LINEAR ALGEBRA, SCALE, VECTOR
863 !***AUTHOR Lawson, C. L., (JPL)
864 ! Hanson, R. J., (SNLA)
865 ! Kincaid, D. R., (U. of Texas)
866 ! Krogh, F. T., (JPL)
867 !***DESCRIPTION
868 ! B L A S Subprogram
869 ! Description of Parameters
870 ! --Input--
871 ! N number of elements in input vector(s)
872 ! DA double precision scale factor
873 ! DX double precision vector with N elements
874 ! INCX storage spacing between elements of DX
875 ! --Output--
876 ! DX double precision result (unchanged if N.LE.0)
877 ! Replace double precision DX by double precision DA*DX.
878 ! For I = 0 to N-1, replace DX(IX+I*INCX) with DA * DX(IX+I*INCX),
879 ! where IX = 1 if INCX .GE. 0, else IX = 1+(1-N)*INCX.
880 !***REFERENCES C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.
881 ! Krogh, Basic linear algebra subprograms for Fortran
882 ! usage, Algorithm No. 539, Transactions on Mathematical
883 ! Software 5, 3 (September 1979), pp. 308-323.
884 !***ROUTINES CALLED (NONE)
885 !***REVISION HISTORY (YYMMDD)
886 ! 791001 DATE WRITTEN
887 ! 890831 Modified array declarations. (WRB)
888 ! 890831 REVISION DATE from Version 3.2
889 ! 891214 Prologue converted to Version 4.0 format. (BAB)
890 ! 900821 Modified to correct problem with a negative increment.
891 ! (WRB)
892 ! 920501 Reformatted the REFERENCES section. (WRB)
893 !***END PROLOGUE DSCAL
894 ! DOUBLE PRECISION :: DA, DX(*)
895 ! INTEGER :: I, INCX, IX, M, MP1, N
896 !***FIRST EXECUTABLE STATEMENT DSCAL
897 ! IF (N <= 0) RETURN
898 ! IF (INCX == 1) GOTO 20
899 ! Code for increment not equal to 1.
900 ! IX = 1
901 ! IF (INCX < 0) IX = (-N+1)*INCX + 1
902 ! DO 10 I = 1,N
903 ! DX(IX) = DA*DX(IX)
904 ! IX = IX + INCX
905 ! 10 END DO
906 ! RETURN
907 ! Code for increment equal to 1.
908 ! Clean-up loop so remaining vector length is a multiple of 5.
909 ! 20 M = MOD(N,5)
910 ! IF (M == 0) GOTO 40
911 ! DO 30 I = 1,M
912 ! DX(I) = DA*DX(I)
913 ! 30 END DO
914 ! IF (N < 5) RETURN
915 ! 40 MP1 = M + 1
916 ! DO 50 I = MP1,N,5
917 ! DX(I) = DA*DX(I)
918 ! DX(I+1) = DA*DX(I+1)
919 ! DX(I+2) = DA*DX(I+2)
920 ! DX(I+3) = DA*DX(I+3)
921 ! DX(I+4) = DA*DX(I+4)
922 ! 50 END DO
923 ! RETURN
924 ! END SUBROUTINE DSCAL
925 ! ECK IDAMAX
926 ! INTEGER FUNCTION IDAMAX (N, DX, INCX)
927 !***BEGIN PROLOGUE IDAMAX
928 !***PURPOSE Find the smallest index of that component of a vector
929 ! having the maximum magnitude.
930 !***CATEGORY D1A2
931 !***TYPE DOUBLE PRECISION (ISAMAX-S, IDAMAX-D, ICAMAX-C)
932 !***KEYWORDS BLAS, LINEAR ALGEBRA, MAXIMUM COMPONENT, VECTOR
933 !***AUTHOR Lawson, C. L., (JPL)
934 ! Hanson, R. J., (SNLA)
935 ! Kincaid, D. R., (U. of Texas)
936 ! Krogh, F. T., (JPL)
937 !***DESCRIPTION
938 ! B L A S Subprogram
939 ! Description of Parameters
940 ! --Input--
941 ! N number of elements in input vector(s)
942 ! DX double precision vector with N elements
943 ! INCX storage spacing between elements of DX
944 ! --Output--
945 ! IDAMAX smallest index (zero if N .LE. 0)
946 ! Find smallest index of maximum magnitude of double precision DX.
947 ! IDAMAX = first I, I = 1 to N, to maximize ABS(DX(IX+(I-1)*INCX)),
948 ! where IX = 1 if INCX .GE. 0, else IX = 1+(1-N)*INCX.
949 !***REFERENCES C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.
950 ! Krogh, Basic linear algebra subprograms for Fortran
951 ! usage, Algorithm No. 539, Transactions on Mathematical
952 ! Software 5, 3 (September 1979), pp. 308-323.
953 !***ROUTINES CALLED (NONE)
954 !***REVISION HISTORY (YYMMDD)
955 ! 791001 DATE WRITTEN
956 ! 890531 Changed all specific intrinsics to generic. (WRB)
957 ! 890531 REVISION DATE from Version 3.2
958 ! 891214 Prologue converted to Version 4.0 format. (BAB)
959 ! 900821 Modified to correct problem with a negative increment.
960 ! (WRB)
961 ! 920501 Reformatted the REFERENCES section. (WRB)
962 !***END PROLOGUE IDAMAX
963 ! DOUBLE PRECISION :: DX(*), DMAX, XMAG
964 ! INTEGER :: I, INCX, IX, N
965 !***FIRST EXECUTABLE STATEMENT IDAMAX
966 ! IDAMAX = 0
967 ! IF (N <= 0) RETURN
968 ! IDAMAX = 1
969 ! IF (N == 1) RETURN
970 ! IF (INCX == 1) GOTO 20
971 ! Code for increments not equal to 1.
972 ! IX = 1
973 ! IF (INCX < 0) IX = (-N+1)*INCX + 1
974 ! DMAX = ABS(DX(IX))
975 ! IX = IX + INCX
976 ! DO 10 I = 2,N
977 ! XMAG = ABS(DX(IX))
978 ! IF (XMAG > DMAX) THEN
979 ! IDAMAX = I
980 ! DMAX = XMAG
981 ! ENDIF
982 ! IX = IX + INCX
983 ! 10 END DO
984 ! RETURN
985 ! Code for increments equal to 1.
986 ! 20 DMAX = ABS(DX(1))
987 ! DO 30 I = 2,N
988 ! XMAG = ABS(DX(I))
989 ! IF (XMAG > DMAX) THEN
990 ! IDAMAX = I
991 ! DMAX = XMAG
992 ! ENDIF
993 ! 30 END DO
994 ! RETURN
995 ! END FUNCTION IDAMAX
996 ! ECK XERRWD
997 ! SUBROUTINE XERRWD (MSG, NMES, NERR, LEVEL, NI, I1, I2, NR, R1, R2)
998 !***BEGIN PROLOGUE XERRWD
999 !***SUBSIDIARY
1000 !***PURPOSE Write error message with values.
1001 !***CATEGORY R3C
1002 !***TYPE DOUBLE PRECISION (XERRWV-S, XERRWD-D)
1003 !***AUTHOR Hindmarsh, Alan C., (LLNL)
1004 !***DESCRIPTION
1005 ! Subroutines XERRWD, XSETF, XSETUN, and the function routine IXSAV,
1006 ! as given here, constitute a simplified version of the SLATEC error
1007 ! handling package.
1008 ! All arguments are input arguments.
1009 ! MSG = The message (character array).
1010 ! NMES = The length of MSG (number of characters).
1011 ! NERR = The error number (not used).
1012 ! LEVEL = The error level..
1013 ! 0 or 1 means recoverable (control returns to caller).
1014 ! 2 means fatal (run is aborted--see note below).
1015 ! NI = Number of integers (0, 1, or 2) to be printed with message.
1016 ! I1,I2 = Integers to be printed, depending on NI.
1017 ! NR = Number of reals (0, 1, or 2) to be printed with message.
1018 ! R1,R2 = Reals to be printed, depending on NR.
1019 ! Note.. this routine is machine-dependent and specialized for use
1020 ! in limited context, in the following ways..
1021 ! 1. The argument MSG is assumed to be of type CHARACTER, and
1022 ! the message is printed with a format of (1X,A).
1023 ! 2. The message is assumed to take only one line.
1024 ! Multi-line messages are generated by repeated calls.
1025 ! 3. If LEVEL = 2, control passes to the statement STOP
1026 ! to abort the run. This statement may be machine-dependent.
1027 ! 4. R1 and R2 are assumed to be in double precision and are printed
1028 ! in D21.13 format.
1029 !***ROUTINES CALLED IXSAV
1030 !***REVISION HISTORY (YYMMDD)
1031 ! 920831 DATE WRITTEN
1032 ! 921118 Replaced MFLGSV/LUNSAV by IXSAV. (ACH)
1033 ! 930329 Modified prologue to SLATEC format. (FNF)
1034 ! 930407 Changed MSG from CHARACTER*1 array to variable. (FNF)
1035 ! 930922 Minor cosmetic change. (FNF)
1036 !***END PROLOGUE XERRWD
1037 ! Internal Notes:
1038 ! For a different default logical unit number, IXSAV (or a subsidiary
1039 ! routine that it calls) will need to be modified.
1040 ! For a different run-abort command, change the statement following
1041 ! statement 100 at the end.
1042 !-----------------------------------------------------------------------
1043 ! Subroutines called by XERRWD.. None
1044 ! Function routine called by XERRWD.. IXSAV
1045 !-----------------------------------------------------------------------
1046 !**End
1047 ! Declare arguments.
1048 ! DOUBLE PRECISION :: R1, R2
1049 ! INTEGER :: NMES, NERR, LEVEL, NI, I1, I2, NR
1050 ! CHARACTER*(*) MSG
1051 ! Declare local variables.
1052 ! INTEGER :: LUNIT, IXSAV, MESFLG
1053 ! Get logical unit number and message print flag.
1054 !***FIRST EXECUTABLE STATEMENT XERRWD
1055 ! LUNIT = IXSAV (1, 0, .FALSE. )
1056 ! MESFLG = IXSAV (2, 0, .FALSE. )
1057 ! IF (MESFLG == 0) GO TO 100
1058 ! Write the message.
1059 ! WRITE (LUNIT,10) MSG
1060 ! 10 FORMAT(1X,A)
1061 ! IF (NI == 1) WRITE (LUNIT, 20) I1
1062 ! 20 FORMAT(6X,'In above message, I1 =',I10)
1063 ! IF (NI == 2) WRITE (LUNIT, 30) I1,I2
1064 ! 30 FORMAT(6X,'In above message, I1 =',I10,3X,'I2 =',I10)
1065 ! IF (NR == 1) WRITE (LUNIT, 40) R1
1066 ! 40 FORMAT(6X,'In above message, R1 =',D21.13)
1067 ! IF (NR == 2) WRITE (LUNIT, 50) R1,R2
1068 ! 50 FORMAT(6X,'In above, R1 =',D21.13,3X,'R2 =',D21.13)
1069 ! Abort the run if LEVEL = 2.
1070 ! 100 IF (LEVEL /= 2) RETURN
1071 ! STOP
1072 !----------------------- End of Subroutine XERRWD ----------------------
1073 ! END SUBROUTINE XERRWD
1074 ! ECK XSETF
1075 ! SUBROUTINE XSETF (MFLAG)
1076 !***BEGIN PROLOGUE XSETF
1077 !***PURPOSE Reset the error print control flag.
1078 !***CATEGORY R3A
1079 !***TYPE ALL (XSETF-A)
1080 !***KEYWORDS ERROR CONTROL
1081 !***AUTHOR Hindmarsh, Alan C., (LLNL)
1082 !***DESCRIPTION
1083 ! XSETF sets the error print control flag to MFLAG:
1084 ! MFLAG=1 means print all messages (the default).
1085 ! MFLAG=0 means no printing.
1086 !***SEE ALSO XERRWD, XERRWV
1087 !***REFERENCES (NONE)
1088 !***ROUTINES CALLED IXSAV
1089 !***REVISION HISTORY (YYMMDD)
1090 ! 921118 DATE WRITTEN
1091 ! 930329 Added SLATEC format prologue. (FNF)
1092 ! 930407 Corrected SEE ALSO section. (FNF)
1093 ! 930922 Made user-callable, and other cosmetic changes. (FNF)
1094 !***END PROLOGUE XSETF
1095 ! Subroutines called by XSETF.. None
1096 ! Function routine called by XSETF.. IXSAV
1097 !-----------------------------------------------------------------------
1098 !**End
1099 ! INTEGER :: MFLAG, JUNK, IXSAV
1100 !***FIRST EXECUTABLE STATEMENT XSETF
1101 ! IF (MFLAG == 0 .OR. MFLAG == 1) JUNK = IXSAV (2,MFLAG, .TRUE. )
1102 ! RETURN
1103 !----------------------- End of Subroutine XSETF -----------------------
1104 ! END SUBROUTINE XSETF
1105 ! ECK XSETUN
1106 ! SUBROUTINE XSETUN (LUN)
1107 !***BEGIN PROLOGUE XSETUN
1108 !***PURPOSE Reset the logical unit number for error messages.
1109 !***CATEGORY R3B
1110 !***TYPE ALL (XSETUN-A)
1111 !***KEYWORDS ERROR CONTROL
1112 !***DESCRIPTION
1113 ! XSETUN sets the logical unit number for error messages to LUN.
1114 !***AUTHOR Hindmarsh, Alan C., (LLNL)
1115 !***SEE ALSO XERRWD, XERRWV
1116 !***REFERENCES (NONE)
1117 !***ROUTINES CALLED IXSAV
1118 !***REVISION HISTORY (YYMMDD)
1119 ! 921118 DATE WRITTEN
1120 ! 930329 Added SLATEC format prologue. (FNF)
1121 ! 930407 Corrected SEE ALSO section. (FNF)
1122 ! 930922 Made user-callable, and other cosmetic changes. (FNF)
1123 !***END PROLOGUE XSETUN
1124 ! Subroutines called by XSETUN.. None
1125 ! Function routine called by XSETUN.. IXSAV
1126 !-----------------------------------------------------------------------
1127 !**End
1128 ! INTEGER :: LUN, JUNK, IXSAV
1129 !***FIRST EXECUTABLE STATEMENT XSETUN
1130 ! IF (LUN > 0) JUNK = IXSAV (1,LUN, .TRUE. )
1131 ! RETURN
1132 !----------------------- End of Subroutine XSETUN ----------------------
1133 ! END SUBROUTINE XSETUN
1134 ! ECK IXSAV
1135 ! INTEGER FUNCTION IXSAV (IPAR, IVALUE, ISET)
1136 !***BEGIN PROLOGUE IXSAV
1137 !***SUBSIDIARY
1138 !***PURPOSE Save and recall error message control parameters.
1139 !***CATEGORY R3C
1140 !***TYPE ALL (IXSAV-A)
1141 !***AUTHOR Hindmarsh, Alan C., (LLNL)
1142 !***DESCRIPTION
1143 ! IXSAV saves and recalls one of two error message parameters:
1144 ! LUNIT, the logical unit number to which messages are printed, and
1145 ! MESFLG, the message print flag.
1146 ! This is a modification of the SLATEC library routine J4SAVE.
1147 ! Saved local variables..
1148 ! LUNIT = Logical unit number for messages. The default is obtained
1149 ! by a call to IUMACH (may be machine-dependent).
1150 ! MESFLG = Print control flag..
1151 ! 1 means print all messages (the default).
1152 ! 0 means no printing.
1153 ! On input..
1154 ! IPAR = Parameter indicator (1 for LUNIT, 2 for MESFLG).
1155 ! IVALUE = The value to be set for the parameter, if ISET = .TRUE.
1156 ! ISET = Logical flag to indicate whether to read or write.
1157 ! If ISET = .TRUE., the parameter will be given
1158 ! the value IVALUE. If ISET = .FALSE., the parameter
1159 ! will be unchanged, and IVALUE is a dummy argument.
1160 ! On return..
1161 ! IXSAV = The (old) value of the parameter.
1162 !***SEE ALSO XERRWD, XERRWV
1163 !***ROUTINES CALLED IUMACH
1164 !***REVISION HISTORY (YYMMDD)
1165 ! 921118 DATE WRITTEN
1166 ! 930329 Modified prologue to SLATEC format. (FNF)
1167 ! 930915 Added IUMACH call to get default output unit. (ACH)
1168 ! 930922 Minor cosmetic changes. (FNF)
1169 ! 010425 Type declaration for IUMACH added. (ACH)
1170 !***END PROLOGUE IXSAV
1171 ! Subroutines called by IXSAV.. None
1172 ! Function routine called by IXSAV.. IUMACH
1173 !-----------------------------------------------------------------------
1174 !**End
1175 ! LOGICAL :: ISET
1176 ! INTEGER :: IPAR, IVALUE
1177 !-----------------------------------------------------------------------
1178 ! INTEGER :: IUMACH, LUNIT, MESFLG
1179 !-----------------------------------------------------------------------
1180 ! The following Fortran-77 declaration is to cause the values of the
1181 ! listed (local) variables to be saved between calls to this routine.
1182 !-----------------------------------------------------------------------
1183 ! SAVE LUNIT, MESFLG
1184 ! DATA LUNIT/-1/, MESFLG/1/
1185 !***FIRST EXECUTABLE STATEMENT IXSAV
1186 ! IF (IPAR == 1) THEN
1187 ! IF (LUNIT == -1) LUNIT = IUMACH()
1188 ! IXSAV = LUNIT
1189 ! IF (ISET) LUNIT = IVALUE
1190 ! ENDIF
1191 ! IF (IPAR == 2) THEN
1192 ! IXSAV = MESFLG
1193 ! IF (ISET) MESFLG = IVALUE
1194 ! ENDIF
1195 ! RETURN
1196 !----------------------- End of Function IXSAV -------------------------
1197 ! END FUNCTION IXSAV
1198 ! ECK IUMACH
1199 ! INTEGER FUNCTION IUMACH()
1200 !***BEGIN PROLOGUE IUMACH
1201 !***PURPOSE Provide standard output unit number.
1202 !***CATEGORY R1
1203 !***TYPE INTEGER (IUMACH-I)
1204 !***KEYWORDS MACHINE CONSTANTS
1205 !***AUTHOR Hindmarsh, Alan C., (LLNL)
1206 !***DESCRIPTION
1207 ! *Usage:
1208 ! INTEGER LOUT, IUMACH
1209 ! LOUT = IUMACH()
1210 ! *Function Return Values:
1211 ! LOUT : the standard logical unit for Fortran output.
1212 !***REFERENCES (NONE)
1213 !***ROUTINES CALLED (NONE)
1214 !***REVISION HISTORY (YYMMDD)
1215 ! 930915 DATE WRITTEN
1216 ! 930922 Made user-callable, and other cosmetic changes. (FNF)
1217 !***END PROLOGUE IUMACH
1218 ! Internal Notes:
1219 ! The built-in value of 6 is standard on a wide range of Fortran
1220 ! systems. This may be machine-dependent.
1221 !**End
1222 !***FIRST EXECUTABLE STATEMENT IUMACH
1223 ! IUMACH = 6
1224 ! RETURN
1225 !----------------------- End of Function IUMACH ------------------------
1226 ! END FUNCTION IUMACH