adding link to individual download, the links will appear directly in Doxygen html...
[platform/upstream/lapack.git] / SRC / zgebak.f
1 *> \brief \b ZGEBAK
2 *
3 *  =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at 
6 *            http://www.netlib.org/lapack/explore-html/ 
7 *
8 *> Download ZGEBAK + dependencies 
9 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zgebak.f"> 
10 *> [TGZ]</a> 
11 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zgebak.f"> 
12 *> [ZIP]</a> 
13 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zgebak.f"> 
14 *> [TXT]</a> 
15 *
16 *  Definition
17 *  ==========
18 *
19 *       SUBROUTINE ZGEBAK( JOB, SIDE, N, ILO, IHI, SCALE, M, V, LDV,
20 *                          INFO )
21
22 *       .. Scalar Arguments ..
23 *       CHARACTER          JOB, SIDE
24 *       INTEGER            IHI, ILO, INFO, LDV, M, N
25 *       ..
26 *       .. Array Arguments ..
27 *       DOUBLE PRECISION   SCALE( * )
28 *       COMPLEX*16         V( LDV, * )
29 *       ..
30 *  
31 *  Purpose
32 *  =======
33 *
34 *>\details \b Purpose:
35 *>\verbatim
36 *>
37 *> ZGEBAK forms the right or left eigenvectors of a complex general
38 *> matrix by backward transformation on the computed eigenvectors of the
39 *> balanced matrix output by ZGEBAL.
40 *>
41 *>\endverbatim
42 *
43 *  Arguments
44 *  =========
45 *
46 *> \param[in] JOB
47 *> \verbatim
48 *>          JOB is CHARACTER*1
49 *>          Specifies the type of backward transformation required:
50 *>          = 'N', do nothing, return immediately;
51 *>          = 'P', do backward transformation for permutation only;
52 *>          = 'S', do backward transformation for scaling only;
53 *>          = 'B', do backward transformations for both permutation and
54 *>                 scaling.
55 *>          JOB must be the same as the argument JOB supplied to ZGEBAL.
56 *> \endverbatim
57 *>
58 *> \param[in] SIDE
59 *> \verbatim
60 *>          SIDE is CHARACTER*1
61 *>          = 'R':  V contains right eigenvectors;
62 *>          = 'L':  V contains left eigenvectors.
63 *> \endverbatim
64 *>
65 *> \param[in] N
66 *> \verbatim
67 *>          N is INTEGER
68 *>          The number of rows of the matrix V.  N >= 0.
69 *> \endverbatim
70 *>
71 *> \param[in] ILO
72 *> \verbatim
73 *>          ILO is INTEGER
74 *> \endverbatim
75 *>
76 *> \param[in] IHI
77 *> \verbatim
78 *>          IHI is INTEGER
79 *>          The integers ILO and IHI determined by ZGEBAL.
80 *>          1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
81 *> \endverbatim
82 *>
83 *> \param[in] SCALE
84 *> \verbatim
85 *>          SCALE is DOUBLE PRECISION array, dimension (N)
86 *>          Details of the permutation and scaling factors, as returned
87 *>          by ZGEBAL.
88 *> \endverbatim
89 *>
90 *> \param[in] M
91 *> \verbatim
92 *>          M is INTEGER
93 *>          The number of columns of the matrix V.  M >= 0.
94 *> \endverbatim
95 *>
96 *> \param[in,out] V
97 *> \verbatim
98 *>          V is COMPLEX*16 array, dimension (LDV,M)
99 *>          On entry, the matrix of right or left eigenvectors to be
100 *>          transformed, as returned by ZHSEIN or ZTREVC.
101 *>          On exit, V is overwritten by the transformed eigenvectors.
102 *> \endverbatim
103 *>
104 *> \param[in] LDV
105 *> \verbatim
106 *>          LDV is INTEGER
107 *>          The leading dimension of the array V. LDV >= max(1,N).
108 *> \endverbatim
109 *>
110 *> \param[out] INFO
111 *> \verbatim
112 *>          INFO is INTEGER
113 *>          = 0:  successful exit
114 *>          < 0:  if INFO = -i, the i-th argument had an illegal value.
115 *> \endverbatim
116 *>
117 *
118 *  Authors
119 *  =======
120 *
121 *> \author Univ. of Tennessee 
122 *> \author Univ. of California Berkeley 
123 *> \author Univ. of Colorado Denver 
124 *> \author NAG Ltd. 
125 *
126 *> \date November 2011
127 *
128 *> \ingroup complex16GEcomputational
129 *
130 *  =====================================================================
131       SUBROUTINE ZGEBAK( JOB, SIDE, N, ILO, IHI, SCALE, M, V, LDV,
132      $                   INFO )
133 *
134 *  -- LAPACK computational routine (version 3.2) --
135 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
136 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
137 *     November 2011
138 *
139 *     .. Scalar Arguments ..
140       CHARACTER          JOB, SIDE
141       INTEGER            IHI, ILO, INFO, LDV, M, N
142 *     ..
143 *     .. Array Arguments ..
144       DOUBLE PRECISION   SCALE( * )
145       COMPLEX*16         V( LDV, * )
146 *     ..
147 *
148 *  =====================================================================
149 *
150 *     .. Parameters ..
151       DOUBLE PRECISION   ONE
152       PARAMETER          ( ONE = 1.0D+0 )
153 *     ..
154 *     .. Local Scalars ..
155       LOGICAL            LEFTV, RIGHTV
156       INTEGER            I, II, K
157       DOUBLE PRECISION   S
158 *     ..
159 *     .. External Functions ..
160       LOGICAL            LSAME
161       EXTERNAL           LSAME
162 *     ..
163 *     .. External Subroutines ..
164       EXTERNAL           XERBLA, ZDSCAL, ZSWAP
165 *     ..
166 *     .. Intrinsic Functions ..
167       INTRINSIC          MAX, MIN
168 *     ..
169 *     .. Executable Statements ..
170 *
171 *     Decode and Test the input parameters
172 *
173       RIGHTV = LSAME( SIDE, 'R' )
174       LEFTV = LSAME( SIDE, 'L' )
175 *
176       INFO = 0
177       IF( .NOT.LSAME( JOB, 'N' ) .AND. .NOT.LSAME( JOB, 'P' ) .AND.
178      $    .NOT.LSAME( JOB, 'S' ) .AND. .NOT.LSAME( JOB, 'B' ) ) THEN
179          INFO = -1
180       ELSE IF( .NOT.RIGHTV .AND. .NOT.LEFTV ) THEN
181          INFO = -2
182       ELSE IF( N.LT.0 ) THEN
183          INFO = -3
184       ELSE IF( ILO.LT.1 .OR. ILO.GT.MAX( 1, N ) ) THEN
185          INFO = -4
186       ELSE IF( IHI.LT.MIN( ILO, N ) .OR. IHI.GT.N ) THEN
187          INFO = -5
188       ELSE IF( M.LT.0 ) THEN
189          INFO = -7
190       ELSE IF( LDV.LT.MAX( 1, N ) ) THEN
191          INFO = -9
192       END IF
193       IF( INFO.NE.0 ) THEN
194          CALL XERBLA( 'ZGEBAK', -INFO )
195          RETURN
196       END IF
197 *
198 *     Quick return if possible
199 *
200       IF( N.EQ.0 )
201      $   RETURN
202       IF( M.EQ.0 )
203      $   RETURN
204       IF( LSAME( JOB, 'N' ) )
205      $   RETURN
206 *
207       IF( ILO.EQ.IHI )
208      $   GO TO 30
209 *
210 *     Backward balance
211 *
212       IF( LSAME( JOB, 'S' ) .OR. LSAME( JOB, 'B' ) ) THEN
213 *
214          IF( RIGHTV ) THEN
215             DO 10 I = ILO, IHI
216                S = SCALE( I )
217                CALL ZDSCAL( M, S, V( I, 1 ), LDV )
218    10       CONTINUE
219          END IF
220 *
221          IF( LEFTV ) THEN
222             DO 20 I = ILO, IHI
223                S = ONE / SCALE( I )
224                CALL ZDSCAL( M, S, V( I, 1 ), LDV )
225    20       CONTINUE
226          END IF
227 *
228       END IF
229 *
230 *     Backward permutation
231 *
232 *     For  I = ILO-1 step -1 until 1,
233 *              IHI+1 step 1 until N do --
234 *
235    30 CONTINUE
236       IF( LSAME( JOB, 'P' ) .OR. LSAME( JOB, 'B' ) ) THEN
237          IF( RIGHTV ) THEN
238             DO 40 II = 1, N
239                I = II
240                IF( I.GE.ILO .AND. I.LE.IHI )
241      $            GO TO 40
242                IF( I.LT.ILO )
243      $            I = ILO - II
244                K = SCALE( I )
245                IF( K.EQ.I )
246      $            GO TO 40
247                CALL ZSWAP( M, V( I, 1 ), LDV, V( K, 1 ), LDV )
248    40       CONTINUE
249          END IF
250 *
251          IF( LEFTV ) THEN
252             DO 50 II = 1, N
253                I = II
254                IF( I.GE.ILO .AND. I.LE.IHI )
255      $            GO TO 50
256                IF( I.LT.ILO )
257      $            I = ILO - II
258                K = SCALE( I )
259                IF( K.EQ.I )
260      $            GO TO 50
261                CALL ZSWAP( M, V( I, 1 ), LDV, V( K, 1 ), LDV )
262    50       CONTINUE
263          END IF
264       END IF
265 *
266       RETURN
267 *
268 *     End of ZGEBAK
269 *
270       END