3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SGGBAK + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sggbak.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sggbak.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sggbak.f">
21 * SUBROUTINE SGGBAK( JOB, SIDE, N, ILO, IHI, LSCALE, RSCALE, M, V,
24 * .. Scalar Arguments ..
26 * INTEGER IHI, ILO, INFO, LDV, M, N
28 * .. Array Arguments ..
29 * REAL LSCALE( * ), RSCALE( * ), V( LDV, * )
38 *> SGGBAK forms the right or left eigenvectors of a real generalized
39 *> eigenvalue problem A*x = lambda*B*x, by backward transformation on
40 *> the computed eigenvectors of the balanced pair of matrices output by
50 *> Specifies the type of backward transformation required:
51 *> = 'N': do nothing, return immediately;
52 *> = 'P': do backward transformation for permutation only;
53 *> = 'S': do backward transformation for scaling only;
54 *> = 'B': do backward transformations for both permutation and
56 *> JOB must be the same as the argument JOB supplied to SGGBAL.
61 *> SIDE is CHARACTER*1
62 *> = 'R': V contains right eigenvectors;
63 *> = 'L': V contains left eigenvectors.
69 *> The number of rows of the matrix V. N >= 0.
80 *> The integers ILO and IHI determined by SGGBAL.
81 *> 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
86 *> LSCALE is REAL array, dimension (N)
87 *> Details of the permutations and/or scaling factors applied
88 *> to the left side of A and B, as returned by SGGBAL.
93 *> RSCALE is REAL array, dimension (N)
94 *> Details of the permutations and/or scaling factors applied
95 *> to the right side of A and B, as returned by SGGBAL.
101 *> The number of columns of the matrix V. M >= 0.
106 *> V is REAL array, dimension (LDV,M)
107 *> On entry, the matrix of right or left eigenvectors to be
108 *> transformed, as returned by STGEVC.
109 *> On exit, V is overwritten by the transformed eigenvectors.
115 *> The leading dimension of the matrix V. LDV >= max(1,N).
121 *> = 0: successful exit.
122 *> < 0: if INFO = -i, the i-th argument had an illegal value.
128 *> \author Univ. of Tennessee
129 *> \author Univ. of California Berkeley
130 *> \author Univ. of Colorado Denver
133 *> \date November 2011
135 *> \ingroup realGBcomputational
137 *> \par Further Details:
138 * =====================
142 *> See R.C. Ward, Balancing the generalized eigenvalue problem,
143 *> SIAM J. Sci. Stat. Comp. 2 (1981), 141-152.
146 * =====================================================================
147 SUBROUTINE SGGBAK( JOB, SIDE, N, ILO, IHI, LSCALE, RSCALE, M, V,
150 * -- LAPACK computational routine (version 3.4.0) --
151 * -- LAPACK is a software package provided by Univ. of Tennessee, --
152 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
155 * .. Scalar Arguments ..
157 INTEGER IHI, ILO, INFO, LDV, M, N
159 * .. Array Arguments ..
160 REAL LSCALE( * ), RSCALE( * ), V( LDV, * )
163 * =====================================================================
165 * .. Local Scalars ..
166 LOGICAL LEFTV, RIGHTV
169 * .. External Functions ..
173 * .. External Subroutines ..
174 EXTERNAL SSCAL, SSWAP, XERBLA
176 * .. Intrinsic Functions ..
179 * .. Executable Statements ..
181 * Test the input parameters
183 RIGHTV = LSAME( SIDE, 'R' )
184 LEFTV = LSAME( SIDE, 'L' )
187 IF( .NOT.LSAME( JOB, 'N' ) .AND. .NOT.LSAME( JOB, 'P' ) .AND.
188 $ .NOT.LSAME( JOB, 'S' ) .AND. .NOT.LSAME( JOB, 'B' ) ) THEN
190 ELSE IF( .NOT.RIGHTV .AND. .NOT.LEFTV ) THEN
192 ELSE IF( N.LT.0 ) THEN
194 ELSE IF( ILO.LT.1 ) THEN
196 ELSE IF( N.EQ.0 .AND. IHI.EQ.0 .AND. ILO.NE.1 ) THEN
198 ELSE IF( N.GT.0 .AND. ( IHI.LT.ILO .OR. IHI.GT.MAX( 1, N ) ) )
201 ELSE IF( N.EQ.0 .AND. ILO.EQ.1 .AND. IHI.NE.0 ) THEN
203 ELSE IF( M.LT.0 ) THEN
205 ELSE IF( LDV.LT.MAX( 1, N ) ) THEN
209 CALL XERBLA( 'SGGBAK', -INFO )
213 * Quick return if possible
219 IF( LSAME( JOB, 'N' ) )
227 IF( LSAME( JOB, 'S' ) .OR. LSAME( JOB, 'B' ) ) THEN
229 * Backward transformation on right eigenvectors
233 CALL SSCAL( M, RSCALE( I ), V( I, 1 ), LDV )
237 * Backward transformation on left eigenvectors
241 CALL SSCAL( M, LSCALE( I ), V( I, 1 ), LDV )
246 * Backward permutation
249 IF( LSAME( JOB, 'P' ) .OR. LSAME( JOB, 'B' ) ) THEN
251 * Backward permutation on right eigenvectors
257 DO 40 I = ILO - 1, 1, -1
261 CALL SSWAP( M, V( I, 1 ), LDV, V( K, 1 ), LDV )
271 CALL SSWAP( M, V( I, 1 ), LDV, V( K, 1 ), LDV )
275 * Backward permutation on left eigenvectors
281 DO 80 I = ILO - 1, 1, -1
285 CALL SSWAP( M, V( I, 1 ), LDV, V( K, 1 ), LDV )
291 DO 100 I = IHI + 1, N
295 CALL SSWAP( M, V( I, 1 ), LDV, V( K, 1 ), LDV )