LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
ctrexc.f
Go to the documentation of this file.
1*> \brief \b CTREXC
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download CTREXC + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ctrexc.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ctrexc.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ctrexc.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE CTREXC( COMPQ, N, T, LDT, Q, LDQ, IFST, ILST, INFO )
20*
21* .. Scalar Arguments ..
22* CHARACTER COMPQ
23* INTEGER IFST, ILST, INFO, LDQ, LDT, N
24* ..
25* .. Array Arguments ..
26* COMPLEX Q( LDQ, * ), T( LDT, * )
27* ..
28*
29*
30*> \par Purpose:
31* =============
32*>
33*> \verbatim
34*>
35*> CTREXC reorders the Schur factorization of a complex matrix
36*> A = Q*T*Q**H, so that the diagonal element of T with row index IFST
37*> is moved to row ILST.
38*>
39*> The Schur form T is reordered by a unitary similarity transformation
40*> Z**H*T*Z, and optionally the matrix Q of Schur vectors is updated by
41*> postmultiplying it with Z.
42*> \endverbatim
43*
44* Arguments:
45* ==========
46*
47*> \param[in] COMPQ
48*> \verbatim
49*> COMPQ is CHARACTER*1
50*> = 'V': update the matrix Q of Schur vectors;
51*> = 'N': do not update Q.
52*> \endverbatim
53*>
54*> \param[in] N
55*> \verbatim
56*> N is INTEGER
57*> The order of the matrix T. N >= 0.
58*> If N == 0 arguments ILST and IFST may be any value.
59*> \endverbatim
60*>
61*> \param[in,out] T
62*> \verbatim
63*> T is COMPLEX array, dimension (LDT,N)
64*> On entry, the upper triangular matrix T.
65*> On exit, the reordered upper triangular matrix.
66*> \endverbatim
67*>
68*> \param[in] LDT
69*> \verbatim
70*> LDT is INTEGER
71*> The leading dimension of the array T. LDT >= max(1,N).
72*> \endverbatim
73*>
74*> \param[in,out] Q
75*> \verbatim
76*> Q is COMPLEX array, dimension (LDQ,N)
77*> On entry, if COMPQ = 'V', the matrix Q of Schur vectors.
78*> On exit, if COMPQ = 'V', Q has been postmultiplied by the
79*> unitary transformation matrix Z which reorders T.
80*> If COMPQ = 'N', Q is not referenced.
81*> \endverbatim
82*>
83*> \param[in] LDQ
84*> \verbatim
85*> LDQ is INTEGER
86*> The leading dimension of the array Q. LDQ >= 1, and if
87*> COMPQ = 'V', LDQ >= max(1,N).
88*> \endverbatim
89*>
90*> \param[in] IFST
91*> \verbatim
92*> IFST is INTEGER
93*> \endverbatim
94*>
95*> \param[in] ILST
96*> \verbatim
97*> ILST is INTEGER
98*>
99*> Specify the reordering of the diagonal elements of T:
100*> The element with row index IFST is moved to row ILST by a
101*> sequence of transpositions between adjacent elements.
102*> 1 <= IFST <= N; 1 <= ILST <= N.
103*> \endverbatim
104*>
105*> \param[out] INFO
106*> \verbatim
107*> INFO is INTEGER
108*> = 0: successful exit
109*> < 0: if INFO = -i, the i-th argument had an illegal value
110*> \endverbatim
111*
112* Authors:
113* ========
114*
115*> \author Univ. of Tennessee
116*> \author Univ. of California Berkeley
117*> \author Univ. of Colorado Denver
118*> \author NAG Ltd.
119*
120*> \ingroup trexc
121*
122* =====================================================================
123 SUBROUTINE ctrexc( COMPQ, N, T, LDT, Q, LDQ, IFST, ILST, INFO )
124*
125* -- LAPACK computational routine --
126* -- LAPACK is a software package provided by Univ. of Tennessee, --
127* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
128*
129* .. Scalar Arguments ..
130 CHARACTER COMPQ
131 INTEGER IFST, ILST, INFO, LDQ, LDT, N
132* ..
133* .. Array Arguments ..
134 COMPLEX Q( LDQ, * ), T( LDT, * )
135* ..
136*
137* =====================================================================
138*
139* .. Local Scalars ..
140 LOGICAL WANTQ
141 INTEGER K, M1, M2, M3
142 REAL CS
143 COMPLEX SN, T11, T22, TEMP
144* ..
145* .. External Functions ..
146 LOGICAL LSAME
147 EXTERNAL lsame
148* ..
149* .. External Subroutines ..
150 EXTERNAL clartg, crot, xerbla
151* ..
152* .. Intrinsic Functions ..
153 INTRINSIC conjg, max
154* ..
155* .. Executable Statements ..
156*
157* Decode and test the input parameters.
158*
159 info = 0
160 wantq = lsame( compq, 'V' )
161 IF( .NOT.lsame( compq, 'N' ) .AND. .NOT.wantq ) THEN
162 info = -1
163 ELSE IF( n.LT.0 ) THEN
164 info = -2
165 ELSE IF( ldt.LT.max( 1, n ) ) THEN
166 info = -4
167 ELSE IF( ldq.LT.1 .OR. ( wantq .AND. ldq.LT.max( 1, n ) ) ) THEN
168 info = -6
169 ELSE IF(( ifst.LT.1 .OR. ifst.GT.n ).AND.( n.GT.0 )) THEN
170 info = -7
171 ELSE IF(( ilst.LT.1 .OR. ilst.GT.n ).AND.( n.GT.0 )) THEN
172 info = -8
173 END IF
174 IF( info.NE.0 ) THEN
175 CALL xerbla( 'CTREXC', -info )
176 RETURN
177 END IF
178*
179* Quick return if possible
180*
181 IF( n.LE.1 .OR. ifst.EQ.ilst )
182 $ RETURN
183*
184 IF( ifst.LT.ilst ) THEN
185*
186* Move the IFST-th diagonal element forward down the diagonal.
187*
188 m1 = 0
189 m2 = -1
190 m3 = 1
191 ELSE
192*
193* Move the IFST-th diagonal element backward up the diagonal.
194*
195 m1 = -1
196 m2 = 0
197 m3 = -1
198 END IF
199*
200 DO 10 k = ifst + m1, ilst + m2, m3
201*
202* Interchange the k-th and (k+1)-th diagonal elements.
203*
204 t11 = t( k, k )
205 t22 = t( k+1, k+1 )
206*
207* Determine the transformation to perform the interchange.
208*
209 CALL clartg( t( k, k+1 ), t22-t11, cs, sn, temp )
210*
211* Apply transformation to the matrix T.
212*
213 IF( k+2.LE.n )
214 $ CALL crot( n-k-1, t( k, k+2 ), ldt, t( k+1, k+2 ), ldt,
215 $ cs,
216 $ sn )
217 CALL crot( k-1, t( 1, k ), 1, t( 1, k+1 ), 1, cs,
218 $ conjg( sn ) )
219*
220 t( k, k ) = t22
221 t( k+1, k+1 ) = t11
222*
223 IF( wantq ) THEN
224*
225* Accumulate transformation in the matrix Q.
226*
227 CALL crot( n, q( 1, k ), 1, q( 1, k+1 ), 1, cs,
228 $ conjg( sn ) )
229 END IF
230*
231 10 CONTINUE
232*
233 RETURN
234*
235* End of CTREXC
236*
237 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine clartg(f, g, c, s, r)
CLARTG generates a plane rotation with real cosine and complex sine.
Definition clartg.f90:116
subroutine crot(n, cx, incx, cy, incy, c, s)
CROT applies a plane rotation with real cosine and complex sine to a pair of complex vectors.
Definition crot.f:101
subroutine ctrexc(compq, n, t, ldt, q, ldq, ifst, ilst, info)
CTREXC
Definition ctrexc.f:124