LAPACK 3.3.0
|
00001 SUBROUTINE CGEBAK( JOB, SIDE, N, ILO, IHI, SCALE, M, V, LDV, 00002 $ INFO ) 00003 * 00004 * -- LAPACK routine (version 3.2) -- 00005 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00006 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00007 * November 2006 00008 * 00009 * .. Scalar Arguments .. 00010 CHARACTER JOB, SIDE 00011 INTEGER IHI, ILO, INFO, LDV, M, N 00012 * .. 00013 * .. Array Arguments .. 00014 REAL SCALE( * ) 00015 COMPLEX V( LDV, * ) 00016 * .. 00017 * 00018 * Purpose 00019 * ======= 00020 * 00021 * CGEBAK forms the right or left eigenvectors of a complex general 00022 * matrix by backward transformation on the computed eigenvectors of the 00023 * balanced matrix output by CGEBAL. 00024 * 00025 * Arguments 00026 * ========= 00027 * 00028 * JOB (input) CHARACTER*1 00029 * Specifies the type of backward transformation required: 00030 * = 'N', do nothing, return immediately; 00031 * = 'P', do backward transformation for permutation only; 00032 * = 'S', do backward transformation for scaling only; 00033 * = 'B', do backward transformations for both permutation and 00034 * scaling. 00035 * JOB must be the same as the argument JOB supplied to CGEBAL. 00036 * 00037 * SIDE (input) CHARACTER*1 00038 * = 'R': V contains right eigenvectors; 00039 * = 'L': V contains left eigenvectors. 00040 * 00041 * N (input) INTEGER 00042 * The number of rows of the matrix V. N >= 0. 00043 * 00044 * ILO (input) INTEGER 00045 * IHI (input) INTEGER 00046 * The integers ILO and IHI determined by CGEBAL. 00047 * 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0. 00048 * 00049 * SCALE (input) REAL array, dimension (N) 00050 * Details of the permutation and scaling factors, as returned 00051 * by CGEBAL. 00052 * 00053 * M (input) INTEGER 00054 * The number of columns of the matrix V. M >= 0. 00055 * 00056 * V (input/output) COMPLEX array, dimension (LDV,M) 00057 * On entry, the matrix of right or left eigenvectors to be 00058 * transformed, as returned by CHSEIN or CTREVC. 00059 * On exit, V is overwritten by the transformed eigenvectors. 00060 * 00061 * LDV (input) INTEGER 00062 * The leading dimension of the array V. LDV >= max(1,N). 00063 * 00064 * INFO (output) INTEGER 00065 * = 0: successful exit 00066 * < 0: if INFO = -i, the i-th argument had an illegal value. 00067 * 00068 * ===================================================================== 00069 * 00070 * .. Parameters .. 00071 REAL ONE 00072 PARAMETER ( ONE = 1.0E+0 ) 00073 * .. 00074 * .. Local Scalars .. 00075 LOGICAL LEFTV, RIGHTV 00076 INTEGER I, II, K 00077 REAL S 00078 * .. 00079 * .. External Functions .. 00080 LOGICAL LSAME 00081 EXTERNAL LSAME 00082 * .. 00083 * .. External Subroutines .. 00084 EXTERNAL CSSCAL, CSWAP, XERBLA 00085 * .. 00086 * .. Intrinsic Functions .. 00087 INTRINSIC MAX, MIN 00088 * .. 00089 * .. Executable Statements .. 00090 * 00091 * Decode and Test the input parameters 00092 * 00093 RIGHTV = LSAME( SIDE, 'R' ) 00094 LEFTV = LSAME( SIDE, 'L' ) 00095 * 00096 INFO = 0 00097 IF( .NOT.LSAME( JOB, 'N' ) .AND. .NOT.LSAME( JOB, 'P' ) .AND. 00098 $ .NOT.LSAME( JOB, 'S' ) .AND. .NOT.LSAME( JOB, 'B' ) ) THEN 00099 INFO = -1 00100 ELSE IF( .NOT.RIGHTV .AND. .NOT.LEFTV ) THEN 00101 INFO = -2 00102 ELSE IF( N.LT.0 ) THEN 00103 INFO = -3 00104 ELSE IF( ILO.LT.1 .OR. ILO.GT.MAX( 1, N ) ) THEN 00105 INFO = -4 00106 ELSE IF( IHI.LT.MIN( ILO, N ) .OR. IHI.GT.N ) THEN 00107 INFO = -5 00108 ELSE IF( M.LT.0 ) THEN 00109 INFO = -7 00110 ELSE IF( LDV.LT.MAX( 1, N ) ) THEN 00111 INFO = -9 00112 END IF 00113 IF( INFO.NE.0 ) THEN 00114 CALL XERBLA( 'CGEBAK', -INFO ) 00115 RETURN 00116 END IF 00117 * 00118 * Quick return if possible 00119 * 00120 IF( N.EQ.0 ) 00121 $ RETURN 00122 IF( M.EQ.0 ) 00123 $ RETURN 00124 IF( LSAME( JOB, 'N' ) ) 00125 $ RETURN 00126 * 00127 IF( ILO.EQ.IHI ) 00128 $ GO TO 30 00129 * 00130 * Backward balance 00131 * 00132 IF( LSAME( JOB, 'S' ) .OR. LSAME( JOB, 'B' ) ) THEN 00133 * 00134 IF( RIGHTV ) THEN 00135 DO 10 I = ILO, IHI 00136 S = SCALE( I ) 00137 CALL CSSCAL( M, S, V( I, 1 ), LDV ) 00138 10 CONTINUE 00139 END IF 00140 * 00141 IF( LEFTV ) THEN 00142 DO 20 I = ILO, IHI 00143 S = ONE / SCALE( I ) 00144 CALL CSSCAL( M, S, V( I, 1 ), LDV ) 00145 20 CONTINUE 00146 END IF 00147 * 00148 END IF 00149 * 00150 * Backward permutation 00151 * 00152 * For I = ILO-1 step -1 until 1, 00153 * IHI+1 step 1 until N do -- 00154 * 00155 30 CONTINUE 00156 IF( LSAME( JOB, 'P' ) .OR. LSAME( JOB, 'B' ) ) THEN 00157 IF( RIGHTV ) THEN 00158 DO 40 II = 1, N 00159 I = II 00160 IF( I.GE.ILO .AND. I.LE.IHI ) 00161 $ GO TO 40 00162 IF( I.LT.ILO ) 00163 $ I = ILO - II 00164 K = SCALE( I ) 00165 IF( K.EQ.I ) 00166 $ GO TO 40 00167 CALL CSWAP( M, V( I, 1 ), LDV, V( K, 1 ), LDV ) 00168 40 CONTINUE 00169 END IF 00170 * 00171 IF( LEFTV ) THEN 00172 DO 50 II = 1, N 00173 I = II 00174 IF( I.GE.ILO .AND. I.LE.IHI ) 00175 $ GO TO 50 00176 IF( I.LT.ILO ) 00177 $ I = ILO - II 00178 K = SCALE( I ) 00179 IF( K.EQ.I ) 00180 $ GO TO 50 00181 CALL CSWAP( M, V( I, 1 ), LDV, V( K, 1 ), LDV ) 00182 50 CONTINUE 00183 END IF 00184 END IF 00185 * 00186 RETURN 00187 * 00188 * End of CGEBAK 00189 * 00190 END