3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download CGGBAK + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cggbak.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cggbak.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cggbak.f">
21 * SUBROUTINE CGGBAK( 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( * )
39 *> CGGBAK forms the right or left eigenvectors of a complex generalized
40 *> eigenvalue problem A*x = lambda*B*x, by backward transformation on
41 *> the computed eigenvectors of the balanced pair of matrices output by
51 *> Specifies the type of backward transformation required:
52 *> = 'N': do nothing, return immediately;
53 *> = 'P': do backward transformation for permutation only;
54 *> = 'S': do backward transformation for scaling only;
55 *> = 'B': do backward transformations for both permutation and
57 *> JOB must be the same as the argument JOB supplied to CGGBAL.
62 *> SIDE is CHARACTER*1
63 *> = 'R': V contains right eigenvectors;
64 *> = 'L': V contains left eigenvectors.
70 *> The number of rows of the matrix V. N >= 0.
81 *> The integers ILO and IHI determined by CGGBAL.
82 *> 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
87 *> LSCALE is REAL array, dimension (N)
88 *> Details of the permutations and/or scaling factors applied
89 *> to the left side of A and B, as returned by CGGBAL.
94 *> RSCALE is REAL array, dimension (N)
95 *> Details of the permutations and/or scaling factors applied
96 *> to the right side of A and B, as returned by CGGBAL.
102 *> The number of columns of the matrix V. M >= 0.
107 *> V is COMPLEX array, dimension (LDV,M)
108 *> On entry, the matrix of right or left eigenvectors to be
109 *> transformed, as returned by CTGEVC.
110 *> On exit, V is overwritten by the transformed eigenvectors.
116 *> The leading dimension of the matrix V. LDV >= max(1,N).
122 *> = 0: successful exit.
123 *> < 0: if INFO = -i, the i-th argument had an illegal value.
129 *> \author Univ. of Tennessee
130 *> \author Univ. of California Berkeley
131 *> \author Univ. of Colorado Denver
134 *> \date November 2011
136 *> \ingroup complexGBcomputational
138 *> \par Further Details:
139 * =====================
143 *> See R.C. Ward, Balancing the generalized eigenvalue problem,
144 *> SIAM J. Sci. Stat. Comp. 2 (1981), 141-152.
147 * =====================================================================
148 SUBROUTINE CGGBAK( JOB, SIDE, N, ILO, IHI, LSCALE, RSCALE, M, V,
151 * -- LAPACK computational routine (version 3.4.0) --
152 * -- LAPACK is a software package provided by Univ. of Tennessee, --
153 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
156 * .. Scalar Arguments ..
158 INTEGER IHI, ILO, INFO, LDV, M, N
160 * .. Array Arguments ..
161 REAL LSCALE( * ), RSCALE( * )
165 * =====================================================================
167 * .. Local Scalars ..
168 LOGICAL LEFTV, RIGHTV
171 * .. External Functions ..
175 * .. External Subroutines ..
176 EXTERNAL CSSCAL, CSWAP, XERBLA
178 * .. Intrinsic Functions ..
181 * .. Executable Statements ..
183 * Test the input parameters
185 RIGHTV = LSAME( SIDE, 'R' )
186 LEFTV = LSAME( SIDE, 'L' )
189 IF( .NOT.LSAME( JOB, 'N' ) .AND. .NOT.LSAME( JOB, 'P' ) .AND.
190 $ .NOT.LSAME( JOB, 'S' ) .AND. .NOT.LSAME( JOB, 'B' ) ) THEN
192 ELSE IF( .NOT.RIGHTV .AND. .NOT.LEFTV ) THEN
194 ELSE IF( N.LT.0 ) THEN
196 ELSE IF( ILO.LT.1 ) THEN
198 ELSE IF( N.EQ.0 .AND. IHI.EQ.0 .AND. ILO.NE.1 ) THEN
200 ELSE IF( N.GT.0 .AND. ( IHI.LT.ILO .OR. IHI.GT.MAX( 1, N ) ) )
203 ELSE IF( N.EQ.0 .AND. ILO.EQ.1 .AND. IHI.NE.0 ) THEN
205 ELSE IF( M.LT.0 ) THEN
207 ELSE IF( LDV.LT.MAX( 1, N ) ) THEN
211 CALL XERBLA( 'CGGBAK', -INFO )
215 * Quick return if possible
221 IF( LSAME( JOB, 'N' ) )
229 IF( LSAME( JOB, 'S' ) .OR. LSAME( JOB, 'B' ) ) THEN
231 * Backward transformation on right eigenvectors
235 CALL CSSCAL( M, RSCALE( I ), V( I, 1 ), LDV )
239 * Backward transformation on left eigenvectors
243 CALL CSSCAL( M, LSCALE( I ), V( I, 1 ), LDV )
248 * Backward permutation
251 IF( LSAME( JOB, 'P' ) .OR. LSAME( JOB, 'B' ) ) THEN
253 * Backward permutation on right eigenvectors
258 DO 40 I = ILO - 1, 1, -1
262 CALL CSWAP( M, V( I, 1 ), LDV, V( K, 1 ), LDV )
272 CALL CSWAP( M, V( I, 1 ), LDV, V( K, 1 ), LDV )
276 * Backward permutation on left eigenvectors
282 DO 80 I = ILO - 1, 1, -1
286 CALL CSWAP( M, V( I, 1 ), LDV, V( K, 1 ), LDV )
292 DO 100 I = IHI + 1, N
296 CALL CSWAP( M, V( I, 1 ), LDV, V( K, 1 ), LDV )