LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ zheev_2stage()

subroutine zheev_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  INFO 
)

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

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

Purpose:
 ZHEEV_2STAGE computes all eigenvalues and, optionally, eigenvectors of a
 complex Hermitian matrix A using the 2stage technique for
 the reduction to tridiagonal.
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 length of the array WORK. LWORK >= 1, when N <= 1;
          otherwise  
          If JOBZ = 'N' and N > 1, LWORK must be queried.
                                   LWORK = MAX(1, dimension) where
                                   dimension = max(stage1,stage2) + (KD+1)*N + N
                                             = N*KD + N*max(KD+1,FACTOPTNB) 
                                               + max(2*KD*KD, KD*NTHREADS) 
                                               + (KD+1)*N + N
                                   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 queried. Not yet available

          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 DOUBLE PRECISION 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 2017
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 191 of file zheev_2stage.f.

191 *
192  IMPLICIT NONE
193 *
194 * -- LAPACK driver routine (version 3.8.0) --
195 * -- LAPACK is a software package provided by Univ. of Tennessee, --
196 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
197 * November 2017
198 *
199 * .. Scalar Arguments ..
200  CHARACTER JOBZ, UPLO
201  INTEGER INFO, LDA, LWORK, N
202 * ..
203 * .. Array Arguments ..
204  DOUBLE PRECISION RWORK( * ), W( * )
205  COMPLEX*16 A( LDA, * ), WORK( * )
206 * ..
207 *
208 * =====================================================================
209 *
210 * .. Parameters ..
211  DOUBLE PRECISION ZERO, ONE
212  parameter( zero = 0.0d0, one = 1.0d0 )
213  COMPLEX*16 CONE
214  parameter( cone = ( 1.0d0, 0.0d0 ) )
215 * ..
216 * .. Local Scalars ..
217  LOGICAL LOWER, LQUERY, WANTZ
218  INTEGER IINFO, IMAX, INDE, INDTAU, INDWRK, ISCALE,
219  $ LLWORK, LWMIN, LHTRD, LWTRD, KD, IB, INDHOUS
220  DOUBLE PRECISION ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA,
221  $ SMLNUM
222 * ..
223 * .. External Functions ..
224  LOGICAL LSAME
225  INTEGER ILAENV2STAGE
226  DOUBLE PRECISION DLAMCH, ZLANHE
227  EXTERNAL lsame, dlamch, zlanhe, ilaenv2stage
228 * ..
229 * .. External Subroutines ..
230  EXTERNAL dscal, dsterf, xerbla, zlascl, zsteqr,
232 * ..
233 * .. Intrinsic Functions ..
234  INTRINSIC dble, max, sqrt
235 * ..
236 * .. Executable Statements ..
237 *
238 * Test the input parameters.
239 *
240  wantz = lsame( jobz, 'V' )
241  lower = lsame( uplo, 'L' )
242  lquery = ( lwork.EQ.-1 )
243 *
244  info = 0
245  IF( .NOT.( lsame( jobz, 'N' ) ) ) THEN
246  info = -1
247  ELSE IF( .NOT.( lower .OR. lsame( uplo, 'U' ) ) ) THEN
248  info = -2
249  ELSE IF( n.LT.0 ) THEN
250  info = -3
251  ELSE IF( lda.LT.max( 1, n ) ) THEN
252  info = -5
253  END IF
254 *
255  IF( info.EQ.0 ) THEN
256  kd = ilaenv2stage( 1, 'ZHETRD_2STAGE', jobz, n, -1, -1, -1 )
257  ib = ilaenv2stage( 2, 'ZHETRD_2STAGE', jobz, n, kd, -1, -1 )
258  lhtrd = ilaenv2stage( 3, 'ZHETRD_2STAGE', jobz, n, kd, ib, -1 )
259  lwtrd = ilaenv2stage( 4, 'ZHETRD_2STAGE', jobz, n, kd, ib, -1 )
260  lwmin = n + lhtrd + lwtrd
261  work( 1 ) = lwmin
262 *
263  IF( lwork.LT.lwmin .AND. .NOT.lquery )
264  $ info = -8
265  END IF
266 *
267  IF( info.NE.0 ) THEN
268  CALL xerbla( 'ZHEEV_2STAGE ', -info )
269  RETURN
270  ELSE IF( lquery ) THEN
271  RETURN
272  END IF
273 *
274 * Quick return if possible
275 *
276  IF( n.EQ.0 ) THEN
277  RETURN
278  END IF
279 *
280  IF( n.EQ.1 ) THEN
281  w( 1 ) = dble( a( 1, 1 ) )
282  work( 1 ) = 1
283  IF( wantz )
284  $ a( 1, 1 ) = cone
285  RETURN
286  END IF
287 *
288 * Get machine constants.
289 *
290  safmin = dlamch( 'Safe minimum' )
291  eps = dlamch( 'Precision' )
292  smlnum = safmin / eps
293  bignum = one / smlnum
294  rmin = sqrt( smlnum )
295  rmax = sqrt( bignum )
296 *
297 * Scale matrix to allowable range, if necessary.
298 *
299  anrm = zlanhe( 'M', uplo, n, a, lda, rwork )
300  iscale = 0
301  IF( anrm.GT.zero .AND. anrm.LT.rmin ) THEN
302  iscale = 1
303  sigma = rmin / anrm
304  ELSE IF( anrm.GT.rmax ) THEN
305  iscale = 1
306  sigma = rmax / anrm
307  END IF
308  IF( iscale.EQ.1 )
309  $ CALL zlascl( uplo, 0, 0, one, sigma, n, n, a, lda, info )
310 *
311 * Call ZHETRD_2STAGE to reduce Hermitian matrix to tridiagonal form.
312 *
313  inde = 1
314  indtau = 1
315  indhous = indtau + n
316  indwrk = indhous + lhtrd
317  llwork = lwork - indwrk + 1
318 *
319  CALL zhetrd_2stage( jobz, uplo, n, a, lda, w, rwork( inde ),
320  $ work( indtau ), work( indhous ), lhtrd,
321  $ work( indwrk ), llwork, iinfo )
322 *
323 * For eigenvalues only, call DSTERF. For eigenvectors, first call
324 * ZUNGTR to generate the unitary matrix, then call ZSTEQR.
325 *
326  IF( .NOT.wantz ) THEN
327  CALL dsterf( n, w, rwork( inde ), info )
328  ELSE
329  CALL zungtr( uplo, n, a, lda, work( indtau ), work( indwrk ),
330  $ llwork, iinfo )
331  indwrk = inde + n
332  CALL zsteqr( jobz, n, w, rwork( inde ), a, lda,
333  $ rwork( indwrk ), info )
334  END IF
335 *
336 * If matrix was scaled, then rescale eigenvalues appropriately.
337 *
338  IF( iscale.EQ.1 ) THEN
339  IF( info.EQ.0 ) THEN
340  imax = n
341  ELSE
342  imax = info - 1
343  END IF
344  CALL dscal( imax, one / sigma, w, 1 )
345  END IF
346 *
347 * Set WORK(1) to optimal complex workspace size.
348 *
349  work( 1 ) = lwmin
350 *
351  RETURN
352 *
353 * End of ZHEEV_2STAGE
354 *
Here is the call graph for this function:
Here is the caller graph for this function:
zungtr
subroutine zungtr(UPLO, N, A, LDA, TAU, WORK, LWORK, INFO)
ZUNGTR
Definition: zungtr.f:125
dsterf
subroutine dsterf(N, D, E, INFO)
DSTERF
Definition: dsterf.f:88
zsteqr
subroutine zsteqr(COMPZ, N, D, E, Z, LDZ, WORK, INFO)
ZSTEQR
Definition: zsteqr.f:134
zlanhe
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:126
zlascl
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:145
xerbla
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
lsame
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
ilaenv2stage
integer function ilaenv2stage(ISPEC, NAME, OPTS, N1, N2, N3, N4)
ILAENV2STAGE
Definition: ilaenv2stage.f:151
zhetrd_2stage
subroutine zhetrd_2stage(VECT, UPLO, N, A, LDA, D, E, TAU, HOUS2, LHOUS2, WORK, LWORK, INFO)
ZHETRD_2STAGE
Definition: zhetrd_2stage.f:226
dscal
subroutine dscal(N, DA, DX, INCX)
DSCAL
Definition: dscal.f:81
dlamch
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:70