LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine ctrexc ( character  COMPQ,
integer  N,
complex, dimension( ldt, * )  T,
integer  LDT,
complex, dimension( ldq, * )  Q,
integer  LDQ,
integer  IFST,
integer  ILST,
integer  INFO 
)

CTREXC

Download CTREXC + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 CTREXC reorders the Schur factorization of a complex matrix
 A = Q*T*Q**H, so that the diagonal element of T with row index IFST
 is moved to row ILST.

 The Schur form T is reordered by a unitary similarity transformation
 Z**H*T*Z, and optionally the matrix Q of Schur vectors is updated by
 postmultplying it with Z.
Parameters
[in]COMPQ
          COMPQ is CHARACTER*1
          = 'V':  update the matrix Q of Schur vectors;
          = 'N':  do not update Q.
[in]N
          N is INTEGER
          The order of the matrix T. N >= 0.
[in,out]T
          T is COMPLEX array, dimension (LDT,N)
          On entry, the upper triangular matrix T.
          On exit, the reordered upper triangular matrix.
[in]LDT
          LDT is INTEGER
          The leading dimension of the array T. LDT >= max(1,N).
[in,out]Q
          Q is COMPLEX array, dimension (LDQ,N)
          On entry, if COMPQ = 'V', the matrix Q of Schur vectors.
          On exit, if COMPQ = 'V', Q has been postmultiplied by the
          unitary transformation matrix Z which reorders T.
          If COMPQ = 'N', Q is not referenced.
[in]LDQ
          LDQ is INTEGER
          The leading dimension of the array Q.  LDQ >= max(1,N).
[in]IFST
          IFST is INTEGER
[in]ILST
          ILST is INTEGER

          Specify the reordering of the diagonal elements of T:
          The element with row index IFST is moved to row ILST by a
          sequence of transpositions between adjacent elements.
          1 <= IFST <= N; 1 <= ILST <= N.
[out]INFO
          INFO is INTEGER
          = 0:  successful exit
          < 0:  if INFO = -i, the i-th argument had an illegal value
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 126 of file ctrexc.f.

126 *
127 * -- LAPACK computational routine (version 3.4.0) --
128 * -- LAPACK is a software package provided by Univ. of Tennessee, --
129 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
130 * November 2011
131 *
132 * .. Scalar Arguments ..
133  CHARACTER compq
134  INTEGER ifst, ilst, info, ldq, ldt, n
135 * ..
136 * .. Array Arguments ..
137  COMPLEX q( ldq, * ), t( ldt, * )
138 * ..
139 *
140 * =====================================================================
141 *
142 * .. Local Scalars ..
143  LOGICAL wantq
144  INTEGER k, m1, m2, m3
145  REAL cs
146  COMPLEX sn, t11, t22, temp
147 * ..
148 * .. External Functions ..
149  LOGICAL lsame
150  EXTERNAL lsame
151 * ..
152 * .. External Subroutines ..
153  EXTERNAL clartg, crot, xerbla
154 * ..
155 * .. Intrinsic Functions ..
156  INTRINSIC conjg, max
157 * ..
158 * .. Executable Statements ..
159 *
160 * Decode and test the input parameters.
161 *
162  info = 0
163  wantq = lsame( compq, 'V' )
164  IF( .NOT.lsame( compq, 'N' ) .AND. .NOT.wantq ) THEN
165  info = -1
166  ELSE IF( n.LT.0 ) THEN
167  info = -2
168  ELSE IF( ldt.LT.max( 1, n ) ) THEN
169  info = -4
170  ELSE IF( ldq.LT.1 .OR. ( wantq .AND. ldq.LT.max( 1, n ) ) ) THEN
171  info = -6
172  ELSE IF( ifst.LT.1 .OR. ifst.GT.n ) THEN
173  info = -7
174  ELSE IF( ilst.LT.1 .OR. ilst.GT.n ) THEN
175  info = -8
176  END IF
177  IF( info.NE.0 ) THEN
178  CALL xerbla( 'CTREXC', -info )
179  RETURN
180  END IF
181 *
182 * Quick return if possible
183 *
184  IF( n.EQ.1 .OR. ifst.EQ.ilst )
185  $ RETURN
186 *
187  IF( ifst.LT.ilst ) THEN
188 *
189 * Move the IFST-th diagonal element forward down the diagonal.
190 *
191  m1 = 0
192  m2 = -1
193  m3 = 1
194  ELSE
195 *
196 * Move the IFST-th diagonal element backward up the diagonal.
197 *
198  m1 = -1
199  m2 = 0
200  m3 = -1
201  END IF
202 *
203  DO 10 k = ifst + m1, ilst + m2, m3
204 *
205 * Interchange the k-th and (k+1)-th diagonal elements.
206 *
207  t11 = t( k, k )
208  t22 = t( k+1, k+1 )
209 *
210 * Determine the transformation to perform the interchange.
211 *
212  CALL clartg( t( k, k+1 ), t22-t11, cs, sn, temp )
213 *
214 * Apply transformation to the matrix T.
215 *
216  IF( k+2.LE.n )
217  $ CALL crot( n-k-1, t( k, k+2 ), ldt, t( k+1, k+2 ), ldt, cs,
218  $ sn )
219  CALL crot( k-1, t( 1, k ), 1, t( 1, k+1 ), 1, cs, conjg( sn ) )
220 *
221  t( k, k ) = t22
222  t( k+1, k+1 ) = t11
223 *
224  IF( wantq ) THEN
225 *
226 * Accumulate transformation in the matrix Q.
227 *
228  CALL crot( n, q( 1, k ), 1, q( 1, k+1 ), 1, cs,
229  $ conjg( sn ) )
230  END IF
231 *
232  10 CONTINUE
233 *
234  RETURN
235 *
236 * End of CTREXC
237 *
subroutine clartg(F, G, CS, SN, R)
CLARTG generates a plane rotation with real cosine and complex sine.
Definition: clartg.f:105
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
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:105

Here is the call graph for this function:

Here is the caller graph for this function: