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

◆ chbev_2stage()

subroutine chbev_2stage ( character  jobz,
character  uplo,
integer  n,
integer  kd,
complex, dimension( ldab, * )  ab,
integer  ldab,
real, dimension( * )  w,
complex, dimension( ldz, * )  z,
integer  ldz,
complex, dimension( * )  work,
integer  lwork,
real, dimension( * )  rwork,
integer  info 
)

CHBEV_2STAGE computes the eigenvalues and, optionally, the left and/or right eigenvectors for OTHER matrices

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

Purpose:
 CHBEV_2STAGE computes all the eigenvalues and, optionally, eigenvectors of
 a complex Hermitian band 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]KD
          KD is INTEGER
          The number of superdiagonals of the matrix A if UPLO = 'U',
          or the number of subdiagonals if UPLO = 'L'.  KD >= 0.
[in,out]AB
          AB is COMPLEX array, dimension (LDAB, N)
          On entry, the upper or lower triangle of the Hermitian band
          matrix A, stored in the first KD+1 rows of the array.  The
          j-th column of A is stored in the j-th column of the array AB
          as follows:
          if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
          if UPLO = 'L', AB(1+i-j,j)    = A(i,j) for j<=i<=min(n,j+kd).

          On exit, AB is overwritten by values generated during the
          reduction to tridiagonal form.  If UPLO = 'U', the first
          superdiagonal and the diagonal of the tridiagonal matrix T
          are returned in rows KD and KD+1 of AB, and if UPLO = 'L',
          the diagonal and first subdiagonal of T are returned in the
          first two rows of AB.
[in]LDAB
          LDAB is INTEGER
          The leading dimension of the array AB.  LDAB >= KD + 1.
[out]W
          W is REAL array, dimension (N)
          If INFO = 0, the eigenvalues in ascending order.
[out]Z
          Z is COMPLEX array, dimension (LDZ, N)
          If JOBZ = 'V', then if INFO = 0, Z contains the orthonormal
          eigenvectors of the matrix A, with the i-th column of Z
          holding the eigenvector associated with W(i).
          If JOBZ = 'N', then Z is not referenced.
[in]LDZ
          LDZ is INTEGER
          The leading dimension of the array Z.  LDZ >= 1, and if
          JOBZ = 'V', LDZ >= max(1,N).
[out]WORK
          WORK is COMPLEX array, dimension 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 = (2KD+1)*N + KD*NTHREADS
                                   where KD is the size of the band.
                                   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 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 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 209 of file chbev_2stage.f.

211*
212 IMPLICIT NONE
213*
214* -- LAPACK driver routine --
215* -- LAPACK is a software package provided by Univ. of Tennessee, --
216* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
217*
218* .. Scalar Arguments ..
219 CHARACTER JOBZ, UPLO
220 INTEGER INFO, KD, LDAB, LDZ, N, LWORK
221* ..
222* .. Array Arguments ..
223 REAL RWORK( * ), W( * )
224 COMPLEX AB( LDAB, * ), WORK( * ), Z( LDZ, * )
225* ..
226*
227* =====================================================================
228*
229* .. Parameters ..
230 REAL ZERO, ONE
231 parameter( zero = 0.0e0, one = 1.0e0 )
232* ..
233* .. Local Scalars ..
234 LOGICAL LOWER, WANTZ, LQUERY
235 INTEGER IINFO, IMAX, INDE, INDWRK, INDRWK, ISCALE,
236 $ LLWORK, LWMIN, LHTRD, LWTRD, IB, INDHOUS
237 REAL ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA,
238 $ SMLNUM
239* ..
240* .. External Functions ..
241 LOGICAL LSAME
242 INTEGER ILAENV2STAGE
243 REAL SLAMCH, CLANHB, SROUNDUP_LWORK
244 EXTERNAL lsame, slamch, clanhb, ilaenv2stage,
246* ..
247* .. External Subroutines ..
248 EXTERNAL sscal, ssterf, xerbla, clascl, csteqr,
250* ..
251* .. Intrinsic Functions ..
252 INTRINSIC real, sqrt
253* ..
254* .. Executable Statements ..
255*
256* Test the input parameters.
257*
258 wantz = lsame( jobz, 'V' )
259 lower = lsame( uplo, 'L' )
260 lquery = ( lwork.EQ.-1 )
261*
262 info = 0
263 IF( .NOT.( lsame( jobz, 'N' ) ) ) THEN
264 info = -1
265 ELSE IF( .NOT.( lower .OR. lsame( uplo, 'U' ) ) ) THEN
266 info = -2
267 ELSE IF( n.LT.0 ) THEN
268 info = -3
269 ELSE IF( kd.LT.0 ) THEN
270 info = -4
271 ELSE IF( ldab.LT.kd+1 ) THEN
272 info = -6
273 ELSE IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) ) THEN
274 info = -9
275 END IF
276*
277 IF( info.EQ.0 ) THEN
278 IF( n.LE.1 ) THEN
279 lwmin = 1
280 work( 1 ) = sroundup_lwork(lwmin)
281 ELSE
282 ib = ilaenv2stage( 2, 'CHETRD_HB2ST', jobz,
283 $ n, kd, -1, -1 )
284 lhtrd = ilaenv2stage( 3, 'CHETRD_HB2ST', jobz,
285 $ n, kd, ib, -1 )
286 lwtrd = ilaenv2stage( 4, 'CHETRD_HB2ST', jobz,
287 $ n, kd, ib, -1 )
288 lwmin = lhtrd + lwtrd
289 work( 1 ) = sroundup_lwork(lwmin)
290 ENDIF
291*
292 IF( lwork.LT.lwmin .AND. .NOT.lquery )
293 $ info = -11
294 END IF
295*
296 IF( info.NE.0 ) THEN
297 CALL xerbla( 'CHBEV_2STAGE ', -info )
298 RETURN
299 ELSE IF( lquery ) THEN
300 RETURN
301 END IF
302*
303* Quick return if possible
304*
305 IF( n.EQ.0 )
306 $ RETURN
307*
308 IF( n.EQ.1 ) THEN
309 IF( lower ) THEN
310 w( 1 ) = real( ab( 1, 1 ) )
311 ELSE
312 w( 1 ) = real( ab( kd+1, 1 ) )
313 END IF
314 IF( wantz )
315 $ z( 1, 1 ) = one
316 RETURN
317 END IF
318*
319* Get machine constants.
320*
321 safmin = slamch( 'Safe minimum' )
322 eps = slamch( 'Precision' )
323 smlnum = safmin / eps
324 bignum = one / smlnum
325 rmin = sqrt( smlnum )
326 rmax = sqrt( bignum )
327*
328* Scale matrix to allowable range, if necessary.
329*
330 anrm = clanhb( 'M', uplo, n, kd, ab, ldab, rwork )
331 iscale = 0
332 IF( anrm.GT.zero .AND. anrm.LT.rmin ) THEN
333 iscale = 1
334 sigma = rmin / anrm
335 ELSE IF( anrm.GT.rmax ) THEN
336 iscale = 1
337 sigma = rmax / anrm
338 END IF
339 IF( iscale.EQ.1 ) THEN
340 IF( lower ) THEN
341 CALL clascl( 'B', kd, kd, one, sigma, n, n, ab, ldab, info )
342 ELSE
343 CALL clascl( 'Q', kd, kd, one, sigma, n, n, ab, ldab, info )
344 END IF
345 END IF
346*
347* Call CHBTRD_HB2ST to reduce Hermitian band matrix to tridiagonal form.
348*
349 inde = 1
350 indhous = 1
351 indwrk = indhous + lhtrd
352 llwork = lwork - indwrk + 1
353*
354 CALL chetrd_hb2st( "N", jobz, uplo, n, kd, ab, ldab, w,
355 $ rwork( inde ), work( indhous ), lhtrd,
356 $ work( indwrk ), llwork, iinfo )
357*
358* For eigenvalues only, call SSTERF. For eigenvectors, call CSTEQR.
359*
360 IF( .NOT.wantz ) THEN
361 CALL ssterf( n, w, rwork( inde ), info )
362 ELSE
363 indrwk = inde + n
364 CALL csteqr( jobz, n, w, rwork( inde ), z, ldz,
365 $ rwork( indrwk ), info )
366 END IF
367*
368* If matrix was scaled, then rescale eigenvalues appropriately.
369*
370 IF( iscale.EQ.1 ) THEN
371 IF( info.EQ.0 ) THEN
372 imax = n
373 ELSE
374 imax = info - 1
375 END IF
376 CALL sscal( imax, one / sigma, w, 1 )
377 END IF
378*
379* Set WORK(1) to optimal workspace size.
380*
381 work( 1 ) = sroundup_lwork(lwmin)
382*
383 RETURN
384*
385* End of CHBEV_2STAGE
386*
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
subroutine chetrd_hb2st(stage1, vect, uplo, n, kd, ab, ldab, d, e, hous, lhous, work, lwork, info)
CHETRD_HB2ST reduces a complex Hermitian band matrix A to real symmetric tridiagonal form T
integer function ilaenv2stage(ispec, name, opts, n1, n2, n3, n4)
ILAENV2STAGE
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
real function clanhb(norm, uplo, n, k, ab, ldab, work)
CLANHB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition clanhb.f:132
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
Here is the call graph for this function:
Here is the caller graph for this function: