LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ ctrexc()

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.

Definition at line 125 of file ctrexc.f.

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