2
SUBROUTINE SRLCAL (N, KMP, LL, MAXL, V, Q, RL, SNORMW, PROD,
4
C***BEGIN PROLOGUE SRLCAL
6
C***PURPOSE Internal routine for SGMRES.
7
C***LIBRARY SLATEC (SLAP)
8
C***CATEGORY D2A4, D2B4
9
C***TYPE SINGLE PRECISION (SRLCAL-S, DRLCAL-D)
10
C***KEYWORDS GENERALIZED MINIMUM RESIDUAL, ITERATIVE PRECONDITION,
11
C NON-SYMMETRIC LINEAR SYSTEM, SLAP, SPARSE
12
C***AUTHOR Brown, Peter, (LLNL), pnbrown@llnl.gov
13
C Hindmarsh, Alan, (LLNL), alanh@llnl.gov
14
C Seager, Mark K., (LLNL), seager@llnl.gov
15
C Lawrence Livermore National Laboratory
17
C Livermore, CA 94550 (510) 423-3141
19
C This routine calculates the scaled residual RL from the
22
C INTEGER N, KMP, LL, MAXL
23
C REAL V(N,LL), Q(2*MAXL), RL(N), SNORMW, PROD, R0NORM
25
C CALL SRLCAL(N, KMP, LL, MAXL, V, Q, RL, SNORMW, PROD, R0NRM)
29
C The order of the matrix A, and the lengths
30
C of the vectors SR, SZ, R0 and Z.
32
C The number of previous V vectors the new vector VNEW
33
C must be made orthogonal to. (KMP .le. MAXL)
35
C The current dimension of the Krylov subspace.
37
C The maximum dimension of the Krylov subspace.
39
C The N x LL array containing the orthogonal vectors
41
C Q :IN Real Q(2*MAXL)
42
C A real array of length 2*MAXL containing the components
43
C of the Givens rotations used in the QR decomposition
44
C of HES. It is loaded in SHEQR and used in SHELS.
46
C The residual vector RL. This is either SB*(B-A*XL) if
47
C not preconditioning or preconditioning on the right,
48
C or SB*(M-inverse)*(B-A*XL) if preconditioning on the
53
C The product s1*s2*...*sl = the product of the sines of the
54
C Givens rotations used in the QR factorization of
55
C the Hessenberg matrix HES.
57
C The scaled norm of initial residual R0.
60
C***ROUTINES CALLED SCOPY, SSCAL
61
C***REVISION HISTORY (YYMMDD)
63
C 881213 Previous REVISION DATE
64
C 890915 Made changes requested at July 1989 CML Meeting. (MKS)
65
C 890922 Numerous changes to prologue to make closer to SLATEC
67
C 890929 Numerous changes to reduce SP/DP differences. (FNF)
68
C 910411 Prologue converted to Version 4.0 format. (BAB)
69
C 910506 Made subsidiary to SGMRES. (FNF)
70
C 920511 Added complete declaration section. (WRB)
71
C***END PROLOGUE SRLCAL
72
C The following is for optimized compilation on LLNL/LTSS Crays.
74
C .. Scalar Arguments ..
75
REAL PROD, R0NRM, SNORMW
76
INTEGER KMP, LL, MAXL, N
77
C .. Array Arguments ..
78
REAL Q(*), RL(N), V(N,*)
81
INTEGER I, I2, IP1, K, LLM1, LLP1
82
C .. External Subroutines ..
84
C***FIRST EXECUTABLE STATEMENT SRLCAL
85
IF (KMP .EQ. MAXL) THEN
87
C calculate RL. Start by copying V(*,1) into RL.
89
CALL SCOPY(N, V(1,1), 1, RL, 1)
97
RL(K) = S*RL(K) + C*V(K,IP1)
104
RL(K) = S*RL(K) + C*V(K,LLP1)
108
C When KMP < MAXL, RL vector already partially calculated.
109
C Scale RL by R0NRM*PROD to obtain the residual RL.
112
CALL SSCAL(N, TEM, RL, 1)
114
C------------- LAST LINE OF SRLCAL FOLLOWS ----------------------------