LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine chegs2 ( integer  ITYPE,
character  UPLO,
integer  N,
complex, dimension( lda, * )  A,
integer  LDA,
complex, dimension( ldb, * )  B,
integer  LDB,
integer  INFO 
)

CHEGS2 reduces a Hermitian definite generalized eigenproblem to standard form, using the factorization results obtained from cpotrf (unblocked algorithm).

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

Purpose:
 CHEGS2 reduces a complex Hermitian-definite generalized
 eigenproblem to standard form.

 If ITYPE = 1, the problem is A*x = lambda*B*x,
 and A is overwritten by inv(U**H)*A*inv(U) or inv(L)*A*inv(L**H)

 If ITYPE = 2 or 3, the problem is A*B*x = lambda*x or
 B*A*x = lambda*x, and A is overwritten by U*A*U**H or L**H *A*L.

 B must have been previously factorized as U**H *U or L*L**H by ZPOTRF.
Parameters
[in]ITYPE
          ITYPE is INTEGER
          = 1: compute inv(U**H)*A*inv(U) or inv(L)*A*inv(L**H);
          = 2 or 3: compute U*A*U**H or L**H *A*L.
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          Hermitian matrix A is stored, and how B has been factorized.
          = 'U':  Upper triangular
          = 'L':  Lower triangular
[in]N
          N is INTEGER
          The order of the matrices A and B.  N >= 0.
[in,out]A
          A is COMPLEX array, dimension (LDA,N)
          On entry, the Hermitian matrix A.  If UPLO = 'U', the leading
          n by n upper triangular part of A contains the upper
          triangular part of the matrix A, and the strictly lower
          triangular part of A is not referenced.  If UPLO = 'L', the
          leading n by n lower triangular part of A contains the lower
          triangular part of the matrix A, and the strictly upper
          triangular part of A is not referenced.

          On exit, if INFO = 0, the transformed matrix, stored in the
          same format as A.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[in,out]B
          B is COMPLEX array, dimension (LDB,N)
          The triangular factor from the Cholesky factorization of B,
          as returned by CPOTRF.
[in]LDB
          LDB is INTEGER
          The leading dimension of the array B.  LDB >= max(1,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
September 2012

Definition at line 129 of file chegs2.f.

129 *
130 * -- LAPACK computational routine (version 3.4.2) --
131 * -- LAPACK is a software package provided by Univ. of Tennessee, --
132 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
133 * September 2012
134 *
135 * .. Scalar Arguments ..
136  CHARACTER uplo
137  INTEGER info, itype, lda, ldb, n
138 * ..
139 * .. Array Arguments ..
140  COMPLEX a( lda, * ), b( ldb, * )
141 * ..
142 *
143 * =====================================================================
144 *
145 * .. Parameters ..
146  REAL one, half
147  parameter ( one = 1.0e+0, half = 0.5e+0 )
148  COMPLEX cone
149  parameter ( cone = ( 1.0e+0, 0.0e+0 ) )
150 * ..
151 * .. Local Scalars ..
152  LOGICAL upper
153  INTEGER k
154  REAL akk, bkk
155  COMPLEX ct
156 * ..
157 * .. External Subroutines ..
158  EXTERNAL caxpy, cher2, clacgv, csscal, ctrmv, ctrsv,
159  $ xerbla
160 * ..
161 * .. Intrinsic Functions ..
162  INTRINSIC max
163 * ..
164 * .. External Functions ..
165  LOGICAL lsame
166  EXTERNAL lsame
167 * ..
168 * .. Executable Statements ..
169 *
170 * Test the input parameters.
171 *
172  info = 0
173  upper = lsame( uplo, 'U' )
174  IF( itype.LT.1 .OR. itype.GT.3 ) THEN
175  info = -1
176  ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
177  info = -2
178  ELSE IF( n.LT.0 ) THEN
179  info = -3
180  ELSE IF( lda.LT.max( 1, n ) ) THEN
181  info = -5
182  ELSE IF( ldb.LT.max( 1, n ) ) THEN
183  info = -7
184  END IF
185  IF( info.NE.0 ) THEN
186  CALL xerbla( 'CHEGS2', -info )
187  RETURN
188  END IF
189 *
190  IF( itype.EQ.1 ) THEN
191  IF( upper ) THEN
192 *
193 * Compute inv(U**H)*A*inv(U)
194 *
195  DO 10 k = 1, n
196 *
197 * Update the upper triangle of A(k:n,k:n)
198 *
199  akk = a( k, k )
200  bkk = b( k, k )
201  akk = akk / bkk**2
202  a( k, k ) = akk
203  IF( k.LT.n ) THEN
204  CALL csscal( n-k, one / bkk, a( k, k+1 ), lda )
205  ct = -half*akk
206  CALL clacgv( n-k, a( k, k+1 ), lda )
207  CALL clacgv( n-k, b( k, k+1 ), ldb )
208  CALL caxpy( n-k, ct, b( k, k+1 ), ldb, a( k, k+1 ),
209  $ lda )
210  CALL cher2( uplo, n-k, -cone, a( k, k+1 ), lda,
211  $ b( k, k+1 ), ldb, a( k+1, k+1 ), lda )
212  CALL caxpy( n-k, ct, b( k, k+1 ), ldb, a( k, k+1 ),
213  $ lda )
214  CALL clacgv( n-k, b( k, k+1 ), ldb )
215  CALL ctrsv( uplo, 'Conjugate transpose', 'Non-unit',
216  $ n-k, b( k+1, k+1 ), ldb, a( k, k+1 ),
217  $ lda )
218  CALL clacgv( n-k, a( k, k+1 ), lda )
219  END IF
220  10 CONTINUE
221  ELSE
222 *
223 * Compute inv(L)*A*inv(L**H)
224 *
225  DO 20 k = 1, n
226 *
227 * Update the lower triangle of A(k:n,k:n)
228 *
229  akk = a( k, k )
230  bkk = b( k, k )
231  akk = akk / bkk**2
232  a( k, k ) = akk
233  IF( k.LT.n ) THEN
234  CALL csscal( n-k, one / bkk, a( k+1, k ), 1 )
235  ct = -half*akk
236  CALL caxpy( n-k, ct, b( k+1, k ), 1, a( k+1, k ), 1 )
237  CALL cher2( uplo, n-k, -cone, a( k+1, k ), 1,
238  $ b( k+1, k ), 1, a( k+1, k+1 ), lda )
239  CALL caxpy( n-k, ct, b( k+1, k ), 1, a( k+1, k ), 1 )
240  CALL ctrsv( uplo, 'No transpose', 'Non-unit', n-k,
241  $ b( k+1, k+1 ), ldb, a( k+1, k ), 1 )
242  END IF
243  20 CONTINUE
244  END IF
245  ELSE
246  IF( upper ) THEN
247 *
248 * Compute U*A*U**H
249 *
250  DO 30 k = 1, n
251 *
252 * Update the upper triangle of A(1:k,1:k)
253 *
254  akk = a( k, k )
255  bkk = b( k, k )
256  CALL ctrmv( uplo, 'No transpose', 'Non-unit', k-1, b,
257  $ ldb, a( 1, k ), 1 )
258  ct = half*akk
259  CALL caxpy( k-1, ct, b( 1, k ), 1, a( 1, k ), 1 )
260  CALL cher2( uplo, k-1, cone, a( 1, k ), 1, b( 1, k ), 1,
261  $ a, lda )
262  CALL caxpy( k-1, ct, b( 1, k ), 1, a( 1, k ), 1 )
263  CALL csscal( k-1, bkk, a( 1, k ), 1 )
264  a( k, k ) = akk*bkk**2
265  30 CONTINUE
266  ELSE
267 *
268 * Compute L**H *A*L
269 *
270  DO 40 k = 1, n
271 *
272 * Update the lower triangle of A(1:k,1:k)
273 *
274  akk = a( k, k )
275  bkk = b( k, k )
276  CALL clacgv( k-1, a( k, 1 ), lda )
277  CALL ctrmv( uplo, 'Conjugate transpose', 'Non-unit', k-1,
278  $ b, ldb, a( k, 1 ), lda )
279  ct = half*akk
280  CALL clacgv( k-1, b( k, 1 ), ldb )
281  CALL caxpy( k-1, ct, b( k, 1 ), ldb, a( k, 1 ), lda )
282  CALL cher2( uplo, k-1, cone, a( k, 1 ), lda, b( k, 1 ),
283  $ ldb, a, lda )
284  CALL caxpy( k-1, ct, b( k, 1 ), ldb, a( k, 1 ), lda )
285  CALL clacgv( k-1, b( k, 1 ), ldb )
286  CALL csscal( k-1, bkk, a( k, 1 ), lda )
287  CALL clacgv( k-1, a( k, 1 ), lda )
288  a( k, k ) = akk*bkk**2
289  40 CONTINUE
290  END IF
291  END IF
292  RETURN
293 *
294 * End of CHEGS2
295 *
subroutine ctrsv(UPLO, TRANS, DIAG, N, A, LDA, X, INCX)
CTRSV
Definition: ctrsv.f:151
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine ctrmv(UPLO, TRANS, DIAG, N, A, LDA, X, INCX)
CTRMV
Definition: ctrmv.f:149
subroutine cher2(UPLO, N, ALPHA, X, INCX, Y, INCY, A, LDA)
CHER2
Definition: cher2.f:152
subroutine clacgv(N, X, INCX)
CLACGV conjugates a complex vector.
Definition: clacgv.f:76
subroutine caxpy(N, CA, CX, INCX, CY, INCY)
CAXPY
Definition: caxpy.f:53
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine csscal(N, SA, CX, INCX)
CSSCAL
Definition: csscal.f:54

Here is the call graph for this function:

Here is the caller graph for this function: