LAPACK  3.7.0
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.
          If N == 0 arguments ILST and IFST may be any value.
[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 >= 1, and if
          COMPQ = 'V', 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
December 2016

Definition at line 128 of file ctrexc.f.

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

Here is the call graph for this function:

Here is the caller graph for this function: