LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine cheev ( character  JOBZ,
character  UPLO,
integer  N,
complex, dimension( lda, * )  A,
integer  LDA,
real, dimension( * )  W,
complex, dimension( * )  WORK,
integer  LWORK,
real, dimension( * )  RWORK,
integer  INFO 
)

CHEEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matrices

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

Purpose:
 CHEEV computes all eigenvalues and, optionally, eigenvectors of a
 complex Hermitian matrix A.
Parameters
[in]JOBZ
          JOBZ is CHARACTER*1
          = 'N':  Compute eigenvalues only;
          = 'V':  Compute eigenvalues and eigenvectors.
[in]UPLO
          UPLO is CHARACTER*1
          = 'U':  Upper triangle of A is stored;
          = 'L':  Lower triangle of A is stored.
[in]N
          N is INTEGER
          The order of the matrix A.  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.  If UPLO = 'L',
          the leading N-by-N lower triangular part of A contains
          the lower triangular part of the matrix A.
          On exit, if JOBZ = 'V', then if INFO = 0, A contains the
          orthonormal eigenvectors of the matrix A.
          If JOBZ = 'N', then on exit the lower triangle (if UPLO='L')
          or the upper triangle (if UPLO='U') of A, including the
          diagonal, is destroyed.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[out]W
          W is REAL array, dimension (N)
          If INFO = 0, the eigenvalues in ascending order.
[out]WORK
          WORK is COMPLEX array, dimension (MAX(1,LWORK))
          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
[in]LWORK
          LWORK is INTEGER
          The length of the array WORK.  LWORK >= max(1,2*N-1).
          For optimal efficiency, LWORK >= (NB+1)*N,
          where NB is the blocksize for CHETRD returned by ILAENV.

          If LWORK = -1, then a workspace query is assumed; the routine
          only calculates the optimal size of the WORK array, returns
          this value as the first entry of the WORK array, and no error
          message related to LWORK is issued by XERBLA.
[out]RWORK
          RWORK is REAL array, dimension (max(1, 3*N-2))
[out]INFO
          INFO is INTEGER
          = 0:  successful exit
          < 0:  if INFO = -i, the i-th argument had an illegal value
          > 0:  if INFO = i, the algorithm failed to converge; i
                off-diagonal elements of an intermediate tridiagonal
                form did not converge to zero.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 142 of file cheev.f.

142 *
143 * -- LAPACK driver routine (version 3.4.0) --
144 * -- LAPACK is a software package provided by Univ. of Tennessee, --
145 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
146 * November 2011
147 *
148 * .. Scalar Arguments ..
149  CHARACTER jobz, uplo
150  INTEGER info, lda, lwork, n
151 * ..
152 * .. Array Arguments ..
153  REAL rwork( * ), w( * )
154  COMPLEX a( lda, * ), work( * )
155 * ..
156 *
157 * =====================================================================
158 *
159 * .. Parameters ..
160  REAL zero, one
161  parameter ( zero = 0.0e0, one = 1.0e0 )
162  COMPLEX cone
163  parameter ( cone = ( 1.0e0, 0.0e0 ) )
164 * ..
165 * .. Local Scalars ..
166  LOGICAL lower, lquery, wantz
167  INTEGER iinfo, imax, inde, indtau, indwrk, iscale,
168  $ llwork, lwkopt, nb
169  REAL anrm, bignum, eps, rmax, rmin, safmin, sigma,
170  $ smlnum
171 * ..
172 * .. External Functions ..
173  LOGICAL lsame
174  INTEGER ilaenv
175  REAL clanhe, slamch
176  EXTERNAL ilaenv, lsame, clanhe, slamch
177 * ..
178 * .. External Subroutines ..
179  EXTERNAL chetrd, clascl, csteqr, cungtr, sscal, ssterf,
180  $ xerbla
181 * ..
182 * .. Intrinsic Functions ..
183  INTRINSIC max, sqrt
184 * ..
185 * .. Executable Statements ..
186 *
187 * Test the input parameters.
188 *
189  wantz = lsame( jobz, 'V' )
190  lower = lsame( uplo, 'L' )
191  lquery = ( lwork.EQ.-1 )
192 *
193  info = 0
194  IF( .NOT.( wantz .OR. lsame( jobz, 'N' ) ) ) THEN
195  info = -1
196  ELSE IF( .NOT.( lower .OR. lsame( uplo, 'U' ) ) ) THEN
197  info = -2
198  ELSE IF( n.LT.0 ) THEN
199  info = -3
200  ELSE IF( lda.LT.max( 1, n ) ) THEN
201  info = -5
202  END IF
203 *
204  IF( info.EQ.0 ) THEN
205  nb = ilaenv( 1, 'CHETRD', uplo, n, -1, -1, -1 )
206  lwkopt = max( 1, ( nb+1 )*n )
207  work( 1 ) = lwkopt
208 *
209  IF( lwork.LT.max( 1, 2*n-1 ) .AND. .NOT.lquery )
210  $ info = -8
211  END IF
212 *
213  IF( info.NE.0 ) THEN
214  CALL xerbla( 'CHEEV ', -info )
215  RETURN
216  ELSE IF( lquery ) THEN
217  RETURN
218  END IF
219 *
220 * Quick return if possible
221 *
222  IF( n.EQ.0 ) THEN
223  RETURN
224  END IF
225 *
226  IF( n.EQ.1 ) THEN
227  w( 1 ) = a( 1, 1 )
228  work( 1 ) = 1
229  IF( wantz )
230  $ a( 1, 1 ) = cone
231  RETURN
232  END IF
233 *
234 * Get machine constants.
235 *
236  safmin = slamch( 'Safe minimum' )
237  eps = slamch( 'Precision' )
238  smlnum = safmin / eps
239  bignum = one / smlnum
240  rmin = sqrt( smlnum )
241  rmax = sqrt( bignum )
242 *
243 * Scale matrix to allowable range, if necessary.
244 *
245  anrm = clanhe( 'M', uplo, n, a, lda, rwork )
246  iscale = 0
247  IF( anrm.GT.zero .AND. anrm.LT.rmin ) THEN
248  iscale = 1
249  sigma = rmin / anrm
250  ELSE IF( anrm.GT.rmax ) THEN
251  iscale = 1
252  sigma = rmax / anrm
253  END IF
254  IF( iscale.EQ.1 )
255  $ CALL clascl( uplo, 0, 0, one, sigma, n, n, a, lda, info )
256 *
257 * Call CHETRD to reduce Hermitian matrix to tridiagonal form.
258 *
259  inde = 1
260  indtau = 1
261  indwrk = indtau + n
262  llwork = lwork - indwrk + 1
263  CALL chetrd( uplo, n, a, lda, w, rwork( inde ), work( indtau ),
264  $ work( indwrk ), llwork, iinfo )
265 *
266 * For eigenvalues only, call SSTERF. For eigenvectors, first call
267 * CUNGTR to generate the unitary matrix, then call CSTEQR.
268 *
269  IF( .NOT.wantz ) THEN
270  CALL ssterf( n, w, rwork( inde ), info )
271  ELSE
272  CALL cungtr( uplo, n, a, lda, work( indtau ), work( indwrk ),
273  $ llwork, iinfo )
274  indwrk = inde + n
275  CALL csteqr( jobz, n, w, rwork( inde ), a, lda,
276  $ rwork( indwrk ), info )
277  END IF
278 *
279 * If matrix was scaled, then rescale eigenvalues appropriately.
280 *
281  IF( iscale.EQ.1 ) THEN
282  IF( info.EQ.0 ) THEN
283  imax = n
284  ELSE
285  imax = info - 1
286  END IF
287  CALL sscal( imax, one / sigma, w, 1 )
288  END IF
289 *
290 * Set WORK(1) to optimal complex workspace size.
291 *
292  work( 1 ) = lwkopt
293 *
294  RETURN
295 *
296 * End of CHEEV
297 *
subroutine clascl(TYPE, KL, KU, CFROM, CTO, M, N, A, LDA, INFO)
CLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
Definition: clascl.f:145
real function clanhe(NORM, UPLO, N, A, LDA, WORK)
CLANHE returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a complex Hermitian matrix.
Definition: clanhe.f:126
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine csteqr(COMPZ, N, D, E, Z, LDZ, WORK, INFO)
CSTEQR
Definition: csteqr.f:134
subroutine chetrd(UPLO, N, A, LDA, D, E, TAU, WORK, LWORK, INFO)
CHETRD
Definition: chetrd.f:194
integer function ilaenv(ISPEC, NAME, OPTS, N1, N2, N3, N4)
Definition: tstiee.f:83
subroutine sscal(N, SA, SX, INCX)
SSCAL
Definition: sscal.f:55
subroutine cungtr(UPLO, N, A, LDA, TAU, WORK, LWORK, INFO)
CUNGTR
Definition: cungtr.f:125
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine ssterf(N, D, E, INFO)
SSTERF
Definition: ssterf.f:88
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: