LAPACK  3.10.1
LAPACK: Linear Algebra PACKage

◆ zheevd_2stage()

subroutine zheevd_2stage ( character  JOBZ,
character  UPLO,
integer  N,
complex*16, dimension( lda, * )  A,
integer  LDA,
double precision, dimension( * )  W,
complex*16, dimension( * )  WORK,
integer  LWORK,
double precision, dimension( * )  RWORK,
integer  LRWORK,
integer, dimension( * )  IWORK,
integer  LIWORK,
integer  INFO 
)

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

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

Purpose:
 ZHEEVD_2STAGE computes all eigenvalues and, optionally, eigenvectors of a
 complex Hermitian matrix A using the 2stage technique for
 the reduction to tridiagonal.  If eigenvectors are desired, it uses a
 divide and conquer algorithm.

 The divide and conquer algorithm makes very mild assumptions about
 floating point arithmetic. It will work on machines with a guard
 digit in add/subtract, or on those binary machines without guard
 digits which subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or
 Cray-2. It could conceivably fail on hexadecimal or decimal machines
 without guard digits, but we know of none.
Parameters
[in]JOBZ
          JOBZ is CHARACTER*1
          = 'N':  Compute eigenvalues only;
          = 'V':  Compute eigenvalues and eigenvectors.
                  Not available in this release.
[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*16 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 DOUBLE PRECISION array, dimension (N)
          If INFO = 0, the eigenvalues in ascending order.
[out]WORK
          WORK is COMPLEX*16 array, dimension (MAX(1,LWORK))
          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
[in]LWORK
          LWORK is INTEGER
          The dimension of the array WORK.
          If N <= 1,               LWORK must be at least 1.
          If JOBZ = 'N' and N > 1, LWORK must be queried.
                                   LWORK = MAX(1, dimension) where
                                   dimension = max(stage1,stage2) + (KD+1)*N + N+1
                                             = N*KD + N*max(KD+1,FACTOPTNB) 
                                               + max(2*KD*KD, KD*NTHREADS) 
                                               + (KD+1)*N + N+1
                                   where KD is the blocking size of the reduction,
                                   FACTOPTNB is the blocking used by the QR or LQ
                                   algorithm, usually FACTOPTNB=128 is a good choice
                                   NTHREADS is the number of threads used when
                                   openMP compilation is enabled, otherwise =1.
          If JOBZ = 'V' and N > 1, LWORK must be at least 2*N + N**2

          If LWORK = -1, then a workspace query is assumed; the routine
          only calculates the optimal sizes of the WORK, RWORK and
          IWORK arrays, returns these values as the first entries of
          the WORK, RWORK and IWORK arrays, and no error message
          related to LWORK or LRWORK or LIWORK is issued by XERBLA.
[out]RWORK
          RWORK is DOUBLE PRECISION array,
                                         dimension (LRWORK)
          On exit, if INFO = 0, RWORK(1) returns the optimal LRWORK.
[in]LRWORK
          LRWORK is INTEGER
          The dimension of the array RWORK.
          If N <= 1,                LRWORK must be at least 1.
          If JOBZ  = 'N' and N > 1, LRWORK must be at least N.
          If JOBZ  = 'V' and N > 1, LRWORK must be at least
                         1 + 5*N + 2*N**2.

          If LRWORK = -1, then a workspace query is assumed; the
          routine only calculates the optimal sizes of the WORK, RWORK
          and IWORK arrays, returns these values as the first entries
          of the WORK, RWORK and IWORK arrays, and no error message
          related to LWORK or LRWORK or LIWORK is issued by XERBLA.
[out]IWORK
          IWORK is INTEGER array, dimension (MAX(1,LIWORK))
          On exit, if INFO = 0, IWORK(1) returns the optimal LIWORK.
[in]LIWORK
          LIWORK is INTEGER
          The dimension of the array IWORK.
          If N <= 1,                LIWORK must be at least 1.
          If JOBZ  = 'N' and N > 1, LIWORK must be at least 1.
          If JOBZ  = 'V' and N > 1, LIWORK must be at least 3 + 5*N.

          If LIWORK = -1, then a workspace query is assumed; the
          routine only calculates the optimal sizes of the WORK, RWORK
          and IWORK arrays, returns these values as the first entries
          of the WORK, RWORK and IWORK arrays, and no error message
          related to LWORK or LRWORK or LIWORK is issued by XERBLA.
[out]INFO
          INFO is INTEGER
          = 0:  successful exit
          < 0:  if INFO = -i, the i-th argument had an illegal value
          > 0:  if INFO = i and JOBZ = 'N', then the algorithm failed
                to converge; i off-diagonal elements of an intermediate
                tridiagonal form did not converge to zero;
                if INFO = i and JOBZ = 'V', then the algorithm failed
                to compute an eigenvalue while working on the submatrix
                lying in rows and columns INFO/(N+1) through
                mod(INFO,N+1).
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
Modified description of INFO. Sven, 16 Feb 05.
Contributors:
Jeff Rutter, Computer Science Division, University of California at Berkeley, USA
Further Details:
  All details about the 2stage techniques are available in:

  Azzam Haidar, Hatem Ltaief, and Jack Dongarra.
  Parallel reduction to condensed forms for symmetric eigenvalue problems
  using aggregated fine-grained and memory-aware kernels. In Proceedings
  of 2011 International Conference for High Performance Computing,
  Networking, Storage and Analysis (SC '11), New York, NY, USA,
  Article 8 , 11 pages.
  http://doi.acm.org/10.1145/2063384.2063394

  A. Haidar, J. Kurzak, P. Luszczek, 2013.
  An improved parallel singular value algorithm and its implementation 
  for multicore hardware, In Proceedings of 2013 International Conference
  for High Performance Computing, Networking, Storage and Analysis (SC '13).
  Denver, Colorado, USA, 2013.
  Article 90, 12 pages.
  http://doi.acm.org/10.1145/2503210.2503292

  A. Haidar, R. Solca, S. Tomov, T. Schulthess and J. Dongarra.
  A novel hybrid CPU-GPU generalized eigensolver for electronic structure 
  calculations based on fine-grained memory aware tasks.
  International Journal of High Performance Computing Applications.
  Volume 28 Issue 2, Pages 196-209, May 2014.
  http://hpc.sagepub.com/content/28/2/196 

Definition at line 251 of file zheevd_2stage.f.

253 *
254  IMPLICIT NONE
255 *
256 * -- LAPACK driver routine --
257 * -- LAPACK is a software package provided by Univ. of Tennessee, --
258 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
259 *
260 * .. Scalar Arguments ..
261  CHARACTER JOBZ, UPLO
262  INTEGER INFO, LDA, LIWORK, LRWORK, LWORK, N
263 * ..
264 * .. Array Arguments ..
265  INTEGER IWORK( * )
266  DOUBLE PRECISION RWORK( * ), W( * )
267  COMPLEX*16 A( LDA, * ), WORK( * )
268 * ..
269 *
270 * =====================================================================
271 *
272 * .. Parameters ..
273  DOUBLE PRECISION ZERO, ONE
274  parameter( zero = 0.0d0, one = 1.0d0 )
275  COMPLEX*16 CONE
276  parameter( cone = ( 1.0d0, 0.0d0 ) )
277 * ..
278 * .. Local Scalars ..
279  LOGICAL LOWER, LQUERY, WANTZ
280  INTEGER IINFO, IMAX, INDE, INDRWK, INDTAU, INDWK2,
281  $ INDWRK, ISCALE, LIWMIN, LLRWK, LLWORK,
282  $ LLWRK2, LRWMIN, LWMIN,
283  $ LHTRD, LWTRD, KD, IB, INDHOUS
284 
285 
286  DOUBLE PRECISION ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA,
287  $ SMLNUM
288 * ..
289 * .. External Functions ..
290  LOGICAL LSAME
291  INTEGER ILAENV2STAGE
292  DOUBLE PRECISION DLAMCH, ZLANHE
293  EXTERNAL lsame, dlamch, zlanhe, ilaenv2stage
294 * ..
295 * .. External Subroutines ..
296  EXTERNAL dscal, dsterf, xerbla, zlacpy, zlascl,
298 * ..
299 * .. Intrinsic Functions ..
300  INTRINSIC dble, max, sqrt
301 * ..
302 * .. Executable Statements ..
303 *
304 * Test the input parameters.
305 *
306  wantz = lsame( jobz, 'V' )
307  lower = lsame( uplo, 'L' )
308  lquery = ( lwork.EQ.-1 .OR. lrwork.EQ.-1 .OR. liwork.EQ.-1 )
309 *
310  info = 0
311  IF( .NOT.( lsame( jobz, 'N' ) ) ) THEN
312  info = -1
313  ELSE IF( .NOT.( lower .OR. lsame( uplo, 'U' ) ) ) THEN
314  info = -2
315  ELSE IF( n.LT.0 ) THEN
316  info = -3
317  ELSE IF( lda.LT.max( 1, n ) ) THEN
318  info = -5
319  END IF
320 *
321  IF( info.EQ.0 ) THEN
322  IF( n.LE.1 ) THEN
323  lwmin = 1
324  lrwmin = 1
325  liwmin = 1
326  ELSE
327  kd = ilaenv2stage( 1, 'ZHETRD_2STAGE', jobz,
328  $ n, -1, -1, -1 )
329  ib = ilaenv2stage( 2, 'ZHETRD_2STAGE', jobz,
330  $ n, kd, -1, -1 )
331  lhtrd = ilaenv2stage( 3, 'ZHETRD_2STAGE', jobz,
332  $ n, kd, ib, -1 )
333  lwtrd = ilaenv2stage( 4, 'ZHETRD_2STAGE', jobz,
334  $ n, kd, ib, -1 )
335  IF( wantz ) THEN
336  lwmin = 2*n + n*n
337  lrwmin = 1 + 5*n + 2*n**2
338  liwmin = 3 + 5*n
339  ELSE
340  lwmin = n + 1 + lhtrd + lwtrd
341  lrwmin = n
342  liwmin = 1
343  END IF
344  END IF
345  work( 1 ) = lwmin
346  rwork( 1 ) = lrwmin
347  iwork( 1 ) = liwmin
348 *
349  IF( lwork.LT.lwmin .AND. .NOT.lquery ) THEN
350  info = -8
351  ELSE IF( lrwork.LT.lrwmin .AND. .NOT.lquery ) THEN
352  info = -10
353  ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery ) THEN
354  info = -12
355  END IF
356  END IF
357 *
358  IF( info.NE.0 ) THEN
359  CALL xerbla( 'ZHEEVD_2STAGE', -info )
360  RETURN
361  ELSE IF( lquery ) THEN
362  RETURN
363  END IF
364 *
365 * Quick return if possible
366 *
367  IF( n.EQ.0 )
368  $ RETURN
369 *
370  IF( n.EQ.1 ) THEN
371  w( 1 ) = dble( a( 1, 1 ) )
372  IF( wantz )
373  $ a( 1, 1 ) = cone
374  RETURN
375  END IF
376 *
377 * Get machine constants.
378 *
379  safmin = dlamch( 'Safe minimum' )
380  eps = dlamch( 'Precision' )
381  smlnum = safmin / eps
382  bignum = one / smlnum
383  rmin = sqrt( smlnum )
384  rmax = sqrt( bignum )
385 *
386 * Scale matrix to allowable range, if necessary.
387 *
388  anrm = zlanhe( 'M', uplo, n, a, lda, rwork )
389  iscale = 0
390  IF( anrm.GT.zero .AND. anrm.LT.rmin ) THEN
391  iscale = 1
392  sigma = rmin / anrm
393  ELSE IF( anrm.GT.rmax ) THEN
394  iscale = 1
395  sigma = rmax / anrm
396  END IF
397  IF( iscale.EQ.1 )
398  $ CALL zlascl( uplo, 0, 0, one, sigma, n, n, a, lda, info )
399 *
400 * Call ZHETRD_2STAGE to reduce Hermitian matrix to tridiagonal form.
401 *
402  inde = 1
403  indrwk = inde + n
404  llrwk = lrwork - indrwk + 1
405  indtau = 1
406  indhous = indtau + n
407  indwrk = indhous + lhtrd
408  llwork = lwork - indwrk + 1
409  indwk2 = indwrk + n*n
410  llwrk2 = lwork - indwk2 + 1
411 *
412  CALL zhetrd_2stage( jobz, uplo, n, a, lda, w, rwork( inde ),
413  $ work( indtau ), work( indhous ), lhtrd,
414  $ work( indwrk ), llwork, iinfo )
415 *
416 * For eigenvalues only, call DSTERF. For eigenvectors, first call
417 * ZSTEDC to generate the eigenvector matrix, WORK(INDWRK), of the
418 * tridiagonal matrix, then call ZUNMTR to multiply it to the
419 * Householder transformations represented as Householder vectors in
420 * A.
421 *
422  IF( .NOT.wantz ) THEN
423  CALL dsterf( n, w, rwork( inde ), info )
424  ELSE
425  CALL zstedc( 'I', n, w, rwork( inde ), work( indwrk ), n,
426  $ work( indwk2 ), llwrk2, rwork( indrwk ), llrwk,
427  $ iwork, liwork, info )
428  CALL zunmtr( 'L', uplo, 'N', n, n, a, lda, work( indtau ),
429  $ work( indwrk ), n, work( indwk2 ), llwrk2, iinfo )
430  CALL zlacpy( 'A', n, n, work( indwrk ), n, a, lda )
431  END IF
432 *
433 * If matrix was scaled, then rescale eigenvalues appropriately.
434 *
435  IF( iscale.EQ.1 ) THEN
436  IF( info.EQ.0 ) THEN
437  imax = n
438  ELSE
439  imax = info - 1
440  END IF
441  CALL dscal( imax, one / sigma, w, 1 )
442  END IF
443 *
444  work( 1 ) = lwmin
445  rwork( 1 ) = lrwmin
446  iwork( 1 ) = liwmin
447 *
448  RETURN
449 *
450 * End of ZHEEVD_2STAGE
451 *
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:69
integer function ilaenv2stage(ISPEC, NAME, OPTS, N1, N2, N3, N4)
ILAENV2STAGE
Definition: ilaenv2stage.f:149
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
subroutine dsterf(N, D, E, INFO)
DSTERF
Definition: dsterf.f:86
double precision function zlanhe(NORM, UPLO, N, A, LDA, WORK)
ZLANHE returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition: zlanhe.f:124
subroutine zhetrd_2stage(VECT, UPLO, N, A, LDA, D, E, TAU, HOUS2, LHOUS2, WORK, LWORK, INFO)
ZHETRD_2STAGE
subroutine zlascl(TYPE, KL, KU, CFROM, CTO, M, N, A, LDA, INFO)
ZLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
Definition: zlascl.f:143
subroutine zlacpy(UPLO, M, N, A, LDA, B, LDB)
ZLACPY copies all or part of one two-dimensional array to another.
Definition: zlacpy.f:103
subroutine zunmtr(SIDE, UPLO, TRANS, M, N, A, LDA, TAU, C, LDC, WORK, LWORK, INFO)
ZUNMTR
Definition: zunmtr.f:171
subroutine zstedc(COMPZ, N, D, E, Z, LDZ, WORK, LWORK, RWORK, LRWORK, IWORK, LIWORK, INFO)
ZSTEDC
Definition: zstedc.f:212
subroutine dscal(N, DA, DX, INCX)
DSCAL
Definition: dscal.f:79
Here is the call graph for this function:
Here is the caller graph for this function: