Debian Codegraph @

Modules/ThirdParty/VNL/src/vxl/v3p/netlib/lapack/double/dggbak.f

raw
1 SUBROUTINE DGGBAK( JOB, SIDE, N, ILO, IHI, LSCALE, RSCALE, M, V,
2 $ LDV, INFO )
3 *
4 * -- LAPACK routine (version 3.0) --
5 * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
6 * Courant Institute, Argonne National Lab, and Rice University
7 * September 30, 1994
8 *
9 * .. Scalar Arguments ..
10 CHARACTER JOB, SIDE
11 INTEGER IHI, ILO, INFO, LDV, M, N
12 * ..
13 * .. Array Arguments ..
14 DOUBLE PRECISION LSCALE( * ), RSCALE( * ), V( LDV, * )
15 * ..
16 *
17 * Purpose
18 * =======
19 *
20 * DGGBAK forms the right or left eigenvectors of a real generalized
21 * eigenvalue problem A*x = lambda*B*x, by backward transformation on
22 * the computed eigenvectors of the balanced pair of matrices output by
23 * DGGBAL.
24 *
25 * Arguments
26 * =========
27 *
28 * JOB (input) CHARACTER*1
29 * Specifies the type of backward transformation required:
30 * = 'N': do nothing, return immediately;
31 * = 'P': do backward transformation for permutation only;
32 * = 'S': do backward transformation for scaling only;
33 * = 'B': do backward transformations for both permutation and
34 * scaling.
35 * JOB must be the same as the argument JOB supplied to DGGBAL.
36 *
37 * SIDE (input) CHARACTER*1
38 * = 'R': V contains right eigenvectors;
39 * = 'L': V contains left eigenvectors.
40 *
41 * N (input) INTEGER
42 * The number of rows of the matrix V. N >= 0.
43 *
44 * ILO (input) INTEGER
45 * IHI (input) INTEGER
46 * The integers ILO and IHI determined by DGGBAL.
47 * 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
48 *
49 * LSCALE (input) DOUBLE PRECISION array, dimension (N)
50 * Details of the permutations and/or scaling factors applied
51 * to the left side of A and B, as returned by DGGBAL.
52 *
53 * RSCALE (input) DOUBLE PRECISION array, dimension (N)
54 * Details of the permutations and/or scaling factors applied
55 * to the right side of A and B, as returned by DGGBAL.
56 *
57 * M (input) INTEGER
58 * The number of columns of the matrix V. M >= 0.
59 *
60 * V (input/output) DOUBLE PRECISION array, dimension (LDV,M)
61 * On entry, the matrix of right or left eigenvectors to be
62 * transformed, as returned by DTGEVC.
63 * On exit, V is overwritten by the transformed eigenvectors.
64 *
65 * LDV (input) INTEGER
66 * The leading dimension of the matrix V. LDV >= max(1,N).
67 *
68 * INFO (output) INTEGER
69 * = 0: successful exit.
70 * < 0: if INFO = -i, the i-th argument had an illegal value.
71 *
72 * Further Details
73 * ===============
74 *
75 * See R.C. Ward, Balancing the generalized eigenvalue problem,
76 * SIAM J. Sci. Stat. Comp. 2 (1981), 141-152.
77 *
78 * =====================================================================
79 *
80 * .. Local Scalars ..
81 LOGICAL LEFTV, RIGHTV
82 INTEGER I, K
83 * ..
84 * .. External Functions ..
85 LOGICAL LSAME
86 EXTERNAL LSAME
87 * ..
88 * .. External Subroutines ..
89 EXTERNAL DSCAL, DSWAP, XERBLA
90 * ..
91 * .. Intrinsic Functions ..
92 INTRINSIC MAX
93 * ..
94 * .. Executable Statements ..
95 *
96 * Test the input parameters
97 *
98 RIGHTV = LSAME( SIDE, 'R' )
99 LEFTV = LSAME( SIDE, 'L' )
100 *
101 INFO = 0
102 IF( .NOT.LSAME( JOB, 'N' ) .AND. .NOT.LSAME( JOB, 'P' ) .AND.
103 $ .NOT.LSAME( JOB, 'S' ) .AND. .NOT.LSAME( JOB, 'B' ) ) THEN
104 INFO = -1
105 ELSE IF( .NOT.RIGHTV .AND. .NOT.LEFTV ) THEN
106 INFO = -2
107 ELSE IF( N.LT.0 ) THEN
108 INFO = -3
109 ELSE IF( ILO.LT.1 ) THEN
110 INFO = -4
111 ELSE IF( IHI.LT.ILO .OR. IHI.GT.MAX( 1, N ) ) THEN
112 INFO = -5
113 ELSE IF( M.LT.0 ) THEN
114 INFO = -6
115 ELSE IF( LDV.LT.MAX( 1, N ) ) THEN
116 INFO = -10
117 END IF
118 IF( INFO.NE.0 ) THEN
119 CALL XERBLA( 'DGGBAK', -INFO )
120 RETURN
121 END IF
122 *
123 * Quick return if possible
124 *
125 IF( N.EQ.0 )
126 $ RETURN
127 IF( M.EQ.0 )
128 $ RETURN
129 IF( LSAME( JOB, 'N' ) )
130 $ RETURN
131 *
132 IF( ILO.EQ.IHI )
133 $ GO TO 30
134 *
135 * Backward balance
136 *
137 IF( LSAME( JOB, 'S' ) .OR. LSAME( JOB, 'B' ) ) THEN
138 *
139 * Backward transformation on right eigenvectors
140 *
141 IF( RIGHTV ) THEN
142 DO 10 I = ILO, IHI
143 CALL DSCAL( M, RSCALE( I ), V( I, 1 ), LDV )
144 10 CONTINUE
145 END IF
146 *
147 * Backward transformation on left eigenvectors
148 *
149 IF( LEFTV ) THEN
150 DO 20 I = ILO, IHI
151 CALL DSCAL( M, LSCALE( I ), V( I, 1 ), LDV )
152 20 CONTINUE
153 END IF
154 END IF
155 *
156 * Backward permutation
157 *
158 30 CONTINUE
159 IF( LSAME( JOB, 'P' ) .OR. LSAME( JOB, 'B' ) ) THEN
160 *
161 * Backward permutation on right eigenvectors
162 *
163 IF( RIGHTV ) THEN
164 IF( ILO.EQ.1 )
165 $ GO TO 50
166 *
167 DO 40 I = ILO - 1, 1, -1
168 K = RSCALE( I )
169 IF( K.EQ.I )
170 $ GO TO 40
171 CALL DSWAP( M, V( I, 1 ), LDV, V( K, 1 ), LDV )
172 40 CONTINUE
173 *
174 50 CONTINUE
175 IF( IHI.EQ.N )
176 $ GO TO 70
177 DO 60 I = IHI + 1, N
178 K = RSCALE( I )
179 IF( K.EQ.I )
180 $ GO TO 60
181 CALL DSWAP( M, V( I, 1 ), LDV, V( K, 1 ), LDV )
182 60 CONTINUE
183 END IF
184 *
185 * Backward permutation on left eigenvectors
186 *
187 70 CONTINUE
188 IF( LEFTV ) THEN
189 IF( ILO.EQ.1 )
190 $ GO TO 90
191 DO 80 I = ILO - 1, 1, -1
192 K = LSCALE( I )
193 IF( K.EQ.I )
194 $ GO TO 80
195 CALL DSWAP( M, V( I, 1 ), LDV, V( K, 1 ), LDV )
196 80 CONTINUE
197 *
198 90 CONTINUE
199 IF( IHI.EQ.N )
200 $ GO TO 110
201 DO 100 I = IHI + 1, N
202 K = LSCALE( I )
203 IF( K.EQ.I )
204 $ GO TO 100
205 CALL DSWAP( M, V( I, 1 ), LDV, V( K, 1 ), LDV )
206 100 CONTINUE
207 END IF
208 END IF
209 *
210 110 CONTINUE
211 *
212 RETURN
213 *
214 * End of DGGBAK
215 *
216 END