LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
sggbak.f
Go to the documentation of this file.
1*> \brief \b SGGBAK
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download SGGBAK + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sggbak.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sggbak.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sggbak.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE SGGBAK( JOB, SIDE, N, ILO, IHI, LSCALE, RSCALE, M, V,
20* LDV, INFO )
21*
22* .. Scalar Arguments ..
23* CHARACTER JOB, SIDE
24* INTEGER IHI, ILO, INFO, LDV, M, N
25* ..
26* .. Array Arguments ..
27* REAL LSCALE( * ), RSCALE( * ), V( LDV, * )
28* ..
29*
30*
31*> \par Purpose:
32* =============
33*>
34*> \verbatim
35*>
36*> SGGBAK forms the right or left eigenvectors of a real generalized
37*> eigenvalue problem A*x = lambda*B*x, by backward transformation on
38*> the computed eigenvectors of the balanced pair of matrices output by
39*> SGGBAL.
40*> \endverbatim
41*
42* Arguments:
43* ==========
44*
45*> \param[in] JOB
46*> \verbatim
47*> JOB is CHARACTER*1
48*> Specifies the type of backward transformation required:
49*> = 'N': do nothing, return immediately;
50*> = 'P': do backward transformation for permutation only;
51*> = 'S': do backward transformation for scaling only;
52*> = 'B': do backward transformations for both permutation and
53*> scaling.
54*> JOB must be the same as the argument JOB supplied to SGGBAL.
55*> \endverbatim
56*>
57*> \param[in] SIDE
58*> \verbatim
59*> SIDE is CHARACTER*1
60*> = 'R': V contains right eigenvectors;
61*> = 'L': V contains left eigenvectors.
62*> \endverbatim
63*>
64*> \param[in] N
65*> \verbatim
66*> N is INTEGER
67*> The number of rows of the matrix V. N >= 0.
68*> \endverbatim
69*>
70*> \param[in] ILO
71*> \verbatim
72*> ILO is INTEGER
73*> \endverbatim
74*>
75*> \param[in] IHI
76*> \verbatim
77*> IHI is INTEGER
78*> The integers ILO and IHI determined by SGGBAL.
79*> 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
80*> \endverbatim
81*>
82*> \param[in] LSCALE
83*> \verbatim
84*> LSCALE is REAL array, dimension (N)
85*> Details of the permutations and/or scaling factors applied
86*> to the left side of A and B, as returned by SGGBAL.
87*> \endverbatim
88*>
89*> \param[in] RSCALE
90*> \verbatim
91*> RSCALE is REAL array, dimension (N)
92*> Details of the permutations and/or scaling factors applied
93*> to the right side of A and B, as returned by SGGBAL.
94*> \endverbatim
95*>
96*> \param[in] M
97*> \verbatim
98*> M is INTEGER
99*> The number of columns of the matrix V. M >= 0.
100*> \endverbatim
101*>
102*> \param[in,out] V
103*> \verbatim
104*> V is REAL array, dimension (LDV,M)
105*> On entry, the matrix of right or left eigenvectors to be
106*> transformed, as returned by STGEVC.
107*> On exit, V is overwritten by the transformed eigenvectors.
108*> \endverbatim
109*>
110*> \param[in] LDV
111*> \verbatim
112*> LDV is INTEGER
113*> The leading dimension of the matrix V. LDV >= max(1,N).
114*> \endverbatim
115*>
116*> \param[out] INFO
117*> \verbatim
118*> INFO is INTEGER
119*> = 0: successful exit.
120*> < 0: if INFO = -i, the i-th argument had an illegal value.
121*> \endverbatim
122*
123* Authors:
124* ========
125*
126*> \author Univ. of Tennessee
127*> \author Univ. of California Berkeley
128*> \author Univ. of Colorado Denver
129*> \author NAG Ltd.
130*
131*> \ingroup ggbak
132*
133*> \par Further Details:
134* =====================
135*>
136*> \verbatim
137*>
138*> See R.C. Ward, Balancing the generalized eigenvalue problem,
139*> SIAM J. Sci. Stat. Comp. 2 (1981), 141-152.
140*> \endverbatim
141*>
142* =====================================================================
143 SUBROUTINE sggbak( JOB, SIDE, N, ILO, IHI, LSCALE, RSCALE, M,
144 $ V,
145 $ LDV, INFO )
146*
147* -- LAPACK computational routine --
148* -- LAPACK is a software package provided by Univ. of Tennessee, --
149* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
150*
151* .. Scalar Arguments ..
152 CHARACTER JOB, SIDE
153 INTEGER IHI, ILO, INFO, LDV, M, N
154* ..
155* .. Array Arguments ..
156 REAL LSCALE( * ), RSCALE( * ), V( LDV, * )
157* ..
158*
159* =====================================================================
160*
161* .. Local Scalars ..
162 LOGICAL LEFTV, RIGHTV
163 INTEGER I, K
164* ..
165* .. External Functions ..
166 LOGICAL LSAME
167 EXTERNAL LSAME
168* ..
169* .. External Subroutines ..
170 EXTERNAL sscal, sswap, xerbla
171* ..
172* .. Intrinsic Functions ..
173 INTRINSIC max
174* ..
175* .. Executable Statements ..
176*
177* Test the input parameters
178*
179 rightv = lsame( side, 'R' )
180 leftv = lsame( side, 'L' )
181*
182 info = 0
183 IF( .NOT.lsame( job, 'N' ) .AND.
184 $ .NOT.lsame( job, 'P' ) .AND.
185 $ .NOT.lsame( job, 'S' ) .AND.
186 $ .NOT.lsame( job, 'B' ) ) THEN
187 info = -1
188 ELSE IF( .NOT.rightv .AND. .NOT.leftv ) THEN
189 info = -2
190 ELSE IF( n.LT.0 ) THEN
191 info = -3
192 ELSE IF( ilo.LT.1 ) THEN
193 info = -4
194 ELSE IF( n.EQ.0 .AND. ihi.EQ.0 .AND. ilo.NE.1 ) THEN
195 info = -4
196 ELSE IF( n.GT.0 .AND. ( ihi.LT.ilo .OR. ihi.GT.max( 1, n ) ) )
197 $ THEN
198 info = -5
199 ELSE IF( n.EQ.0 .AND. ilo.EQ.1 .AND. ihi.NE.0 ) THEN
200 info = -5
201 ELSE IF( m.LT.0 ) THEN
202 info = -8
203 ELSE IF( ldv.LT.max( 1, n ) ) THEN
204 info = -10
205 END IF
206 IF( info.NE.0 ) THEN
207 CALL xerbla( 'SGGBAK', -info )
208 RETURN
209 END IF
210*
211* Quick return if possible
212*
213 IF( n.EQ.0 )
214 $ RETURN
215 IF( m.EQ.0 )
216 $ RETURN
217 IF( lsame( job, 'N' ) )
218 $ RETURN
219*
220 IF( ilo.EQ.ihi )
221 $ GO TO 30
222*
223* Backward balance
224*
225 IF( lsame( job, 'S' ) .OR. lsame( job, 'B' ) ) THEN
226*
227* Backward transformation on right eigenvectors
228*
229 IF( rightv ) THEN
230 DO 10 i = ilo, ihi
231 CALL sscal( m, rscale( i ), v( i, 1 ), ldv )
232 10 CONTINUE
233 END IF
234*
235* Backward transformation on left eigenvectors
236*
237 IF( leftv ) THEN
238 DO 20 i = ilo, ihi
239 CALL sscal( m, lscale( i ), v( i, 1 ), ldv )
240 20 CONTINUE
241 END IF
242 END IF
243*
244* Backward permutation
245*
246 30 CONTINUE
247 IF( lsame( job, 'P' ) .OR. lsame( job, 'B' ) ) THEN
248*
249* Backward permutation on right eigenvectors
250*
251 IF( rightv ) THEN
252 IF( ilo.EQ.1 )
253 $ GO TO 50
254*
255 DO 40 i = ilo - 1, 1, -1
256 k = int( rscale( i ) )
257 IF( k.EQ.i )
258 $ GO TO 40
259 CALL sswap( m, v( i, 1 ), ldv, v( k, 1 ), ldv )
260 40 CONTINUE
261*
262 50 CONTINUE
263 IF( ihi.EQ.n )
264 $ GO TO 70
265 DO 60 i = ihi + 1, n
266 k = int( rscale( i ) )
267 IF( k.EQ.i )
268 $ GO TO 60
269 CALL sswap( m, v( i, 1 ), ldv, v( k, 1 ), ldv )
270 60 CONTINUE
271 END IF
272*
273* Backward permutation on left eigenvectors
274*
275 70 CONTINUE
276 IF( leftv ) THEN
277 IF( ilo.EQ.1 )
278 $ GO TO 90
279 DO 80 i = ilo - 1, 1, -1
280 k = int( lscale( i ) )
281 IF( k.EQ.i )
282 $ GO TO 80
283 CALL sswap( m, v( i, 1 ), ldv, v( k, 1 ), ldv )
284 80 CONTINUE
285*
286 90 CONTINUE
287 IF( ihi.EQ.n )
288 $ GO TO 110
289 DO 100 i = ihi + 1, n
290 k = int( lscale( i ) )
291 IF( k.EQ.i )
292 $ GO TO 100
293 CALL sswap( m, v( i, 1 ), ldv, v( k, 1 ), ldv )
294 100 CONTINUE
295 END IF
296 END IF
297*
298 110 CONTINUE
299*
300 RETURN
301*
302* End of SGGBAK
303*
304 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine sggbak(job, side, n, ilo, ihi, lscale, rscale, m, v, ldv, info)
SGGBAK
Definition sggbak.f:146
subroutine sscal(n, sa, sx, incx)
SSCAL
Definition sscal.f:79
subroutine sswap(n, sx, incx, sy, incy)
SSWAP
Definition sswap.f:82