LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ cheev_2stage()

subroutine cheev_2stage ( 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_2STAGE computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matrices

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

Purpose:
 CHEEV_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 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 >= 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 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.
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 187 of file cheev_2stage.f.

189*
190 IMPLICIT NONE
191*
192* -- LAPACK driver routine --
193* -- LAPACK is a software package provided by Univ. of Tennessee, --
194* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
195*
196* .. Scalar Arguments ..
197 CHARACTER JOBZ, UPLO
198 INTEGER INFO, LDA, LWORK, N
199* ..
200* .. Array Arguments ..
201 REAL RWORK( * ), W( * )
202 COMPLEX A( LDA, * ), WORK( * )
203* ..
204*
205* =====================================================================
206*
207* .. Parameters ..
208 REAL ZERO, ONE
209 parameter( zero = 0.0e0, one = 1.0e0 )
210 COMPLEX CONE
211 parameter( cone = ( 1.0e0, 0.0e0 ) )
212* ..
213* .. Local Scalars ..
214 LOGICAL LOWER, LQUERY, WANTZ
215 INTEGER IINFO, IMAX, INDE, INDTAU, INDWRK, ISCALE,
216 $ LLWORK, LWMIN, LHTRD, LWTRD, KD, IB, INDHOUS
217 REAL ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA,
218 $ SMLNUM
219* ..
220* .. External Functions ..
221 LOGICAL LSAME
222 INTEGER ILAENV2STAGE
223 REAL SLAMCH, CLANHE, SROUNDUP_LWORK
224 EXTERNAL lsame, slamch, clanhe, ilaenv2stage,
226* ..
227* .. External Subroutines ..
228 EXTERNAL sscal, ssterf, xerbla, clascl, csteqr,
230* ..
231* .. Intrinsic Functions ..
232 INTRINSIC real, max, sqrt
233* ..
234* .. Executable Statements ..
235*
236* Test the input parameters.
237*
238 wantz = lsame( jobz, 'V' )
239 lower = lsame( uplo, 'L' )
240 lquery = ( lwork.EQ.-1 )
241*
242 info = 0
243 IF( .NOT.( lsame( jobz, 'N' ) ) ) THEN
244 info = -1
245 ELSE IF( .NOT.( lower .OR. lsame( uplo, 'U' ) ) ) THEN
246 info = -2
247 ELSE IF( n.LT.0 ) THEN
248 info = -3
249 ELSE IF( lda.LT.max( 1, n ) ) THEN
250 info = -5
251 END IF
252*
253 IF( info.EQ.0 ) THEN
254 kd = ilaenv2stage( 1, 'CHETRD_2STAGE', jobz, n, -1, -1, -1 )
255 ib = ilaenv2stage( 2, 'CHETRD_2STAGE', jobz, n, kd, -1, -1 )
256 lhtrd = ilaenv2stage( 3, 'CHETRD_2STAGE', jobz, n, kd, ib, -1 )
257 lwtrd = ilaenv2stage( 4, 'CHETRD_2STAGE', jobz, n, kd, ib, -1 )
258 lwmin = n + lhtrd + lwtrd
259 work( 1 ) = sroundup_lwork(lwmin)
260*
261 IF( lwork.LT.lwmin .AND. .NOT.lquery )
262 $ info = -8
263 END IF
264*
265 IF( info.NE.0 ) THEN
266 CALL xerbla( 'CHEEV_2STAGE ', -info )
267 RETURN
268 ELSE IF( lquery ) THEN
269 RETURN
270 END IF
271*
272* Quick return if possible
273*
274 IF( n.EQ.0 ) THEN
275 RETURN
276 END IF
277*
278 IF( n.EQ.1 ) THEN
279 w( 1 ) = real( a( 1, 1 ) )
280 work( 1 ) = 1
281 IF( wantz )
282 $ a( 1, 1 ) = cone
283 RETURN
284 END IF
285*
286* Get machine constants.
287*
288 safmin = slamch( 'Safe minimum' )
289 eps = slamch( 'Precision' )
290 smlnum = safmin / eps
291 bignum = one / smlnum
292 rmin = sqrt( smlnum )
293 rmax = sqrt( bignum )
294*
295* Scale matrix to allowable range, if necessary.
296*
297 anrm = clanhe( 'M', uplo, n, a, lda, rwork )
298 iscale = 0
299 IF( anrm.GT.zero .AND. anrm.LT.rmin ) THEN
300 iscale = 1
301 sigma = rmin / anrm
302 ELSE IF( anrm.GT.rmax ) THEN
303 iscale = 1
304 sigma = rmax / anrm
305 END IF
306 IF( iscale.EQ.1 )
307 $ CALL clascl( uplo, 0, 0, one, sigma, n, n, a, lda, info )
308*
309* Call CHETRD_2STAGE to reduce Hermitian matrix to tridiagonal form.
310*
311 inde = 1
312 indtau = 1
313 indhous = indtau + n
314 indwrk = indhous + lhtrd
315 llwork = lwork - indwrk + 1
316*
317 CALL chetrd_2stage( jobz, uplo, n, a, lda, w, rwork( inde ),
318 $ work( indtau ), work( indhous ), lhtrd,
319 $ work( indwrk ), llwork, iinfo )
320*
321* For eigenvalues only, call SSTERF. For eigenvectors, first call
322* CUNGTR to generate the unitary matrix, then call CSTEQR.
323*
324 IF( .NOT.wantz ) THEN
325 CALL ssterf( n, w, rwork( inde ), info )
326 ELSE
327 CALL cungtr( uplo, n, a, lda, work( indtau ), work( indwrk ),
328 $ llwork, iinfo )
329 indwrk = inde + n
330 CALL csteqr( jobz, n, w, rwork( inde ), a, lda,
331 $ rwork( indwrk ), info )
332 END IF
333*
334* If matrix was scaled, then rescale eigenvalues appropriately.
335*
336 IF( iscale.EQ.1 ) THEN
337 IF( info.EQ.0 ) THEN
338 imax = n
339 ELSE
340 imax = info - 1
341 END IF
342 CALL sscal( imax, one / sigma, w, 1 )
343 END IF
344*
345* Set WORK(1) to optimal complex workspace size.
346*
347 work( 1 ) = sroundup_lwork(lwmin)
348*
349 RETURN
350*
351* End of CHEEV_2STAGE
352*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine chetrd_2stage(vect, uplo, n, a, lda, d, e, tau, hous2, lhous2, work, lwork, info)
CHETRD_2STAGE
integer function ilaenv2stage(ispec, name, opts, n1, n2, n3, n4)
ILAENV2STAGE
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
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,...
Definition clanhe.f:124
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:143
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
real function sroundup_lwork(lwork)
SROUNDUP_LWORK
subroutine sscal(n, sa, sx, incx)
SSCAL
Definition sscal.f:79
subroutine csteqr(compz, n, d, e, z, ldz, work, info)
CSTEQR
Definition csteqr.f:132
subroutine ssterf(n, d, e, info)
SSTERF
Definition ssterf.f:86
subroutine cungtr(uplo, n, a, lda, tau, work, lwork, info)
CUNGTR
Definition cungtr.f:123
Here is the call graph for this function:
Here is the caller graph for this function: