LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
ssyevr.f
Go to the documentation of this file.
1*> \brief <b> SSYEVR computes the eigenvalues and, optionally, the left and/or right eigenvectors for SY matrices</b>
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> \htmlonly
9*> Download SSYEVR + dependencies
10*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ssyevr.f">
11*> [TGZ]</a>
12*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ssyevr.f">
13*> [ZIP]</a>
14*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ssyevr.f">
15*> [TXT]</a>
16*> \endhtmlonly
17*
18* Definition:
19* ===========
20*
21* SUBROUTINE SSYEVR( JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL, IU,
22* ABSTOL, M, W, Z, LDZ, ISUPPZ, WORK, LWORK,
23* IWORK, LIWORK, INFO )
24*
25* .. Scalar Arguments ..
26* CHARACTER JOBZ, RANGE, UPLO
27* INTEGER IL, INFO, IU, LDA, LDZ, LIWORK, LWORK, M, N
28* REAL ABSTOL, VL, VU
29* ..
30* .. Array Arguments ..
31* INTEGER ISUPPZ( * ), IWORK( * )
32* REAL A( LDA, * ), W( * ), WORK( * ), Z( LDZ, * )
33* ..
34*
35*
36*> \par Purpose:
37* =============
38*>
39*> \verbatim
40*>
41*> SSYEVR computes selected eigenvalues and, optionally, eigenvectors
42*> of a real symmetric matrix A. Eigenvalues and eigenvectors can be
43*> selected by specifying either a range of values or a range of
44*> indices for the desired eigenvalues.
45*>
46*> SSYEVR first reduces the matrix A to tridiagonal form T with a call
47*> to SSYTRD. Then, whenever possible, SSYEVR calls SSTEMR to compute
48*> the eigenspectrum using Relatively Robust Representations. SSTEMR
49*> computes eigenvalues by the dqds algorithm, while orthogonal
50*> eigenvectors are computed from various "good" L D L^T representations
51*> (also known as Relatively Robust Representations). Gram-Schmidt
52*> orthogonalization is avoided as far as possible. More specifically,
53*> the various steps of the algorithm are as follows.
54*>
55*> For each unreduced block (submatrix) of T,
56*> (a) Compute T - sigma I = L D L^T, so that L and D
57*> define all the wanted eigenvalues to high relative accuracy.
58*> This means that small relative changes in the entries of D and L
59*> cause only small relative changes in the eigenvalues and
60*> eigenvectors. The standard (unfactored) representation of the
61*> tridiagonal matrix T does not have this property in general.
62*> (b) Compute the eigenvalues to suitable accuracy.
63*> If the eigenvectors are desired, the algorithm attains full
64*> accuracy of the computed eigenvalues only right before
65*> the corresponding vectors have to be computed, see steps c) and d).
66*> (c) For each cluster of close eigenvalues, select a new
67*> shift close to the cluster, find a new factorization, and refine
68*> the shifted eigenvalues to suitable accuracy.
69*> (d) For each eigenvalue with a large enough relative separation compute
70*> the corresponding eigenvector by forming a rank revealing twisted
71*> factorization. Go back to (c) for any clusters that remain.
72*>
73*> The desired accuracy of the output can be specified by the input
74*> parameter ABSTOL.
75*>
76*> For more details, see SSTEMR's documentation and:
77*> - Inderjit S. Dhillon and Beresford N. Parlett: "Multiple representations
78*> to compute orthogonal eigenvectors of symmetric tridiagonal matrices,"
79*> Linear Algebra and its Applications, 387(1), pp. 1-28, August 2004.
80*> - Inderjit Dhillon and Beresford Parlett: "Orthogonal Eigenvectors and
81*> Relative Gaps," SIAM Journal on Matrix Analysis and Applications, Vol. 25,
82*> 2004. Also LAPACK Working Note 154.
83*> - Inderjit Dhillon: "A new O(n^2) algorithm for the symmetric
84*> tridiagonal eigenvalue/eigenvector problem",
85*> Computer Science Division Technical Report No. UCB/CSD-97-971,
86*> UC Berkeley, May 1997.
87*>
88*>
89*> Note 1 : SSYEVR calls SSTEMR when the full spectrum is requested
90*> on machines which conform to the ieee-754 floating point standard.
91*> SSYEVR calls SSTEBZ and SSTEIN on non-ieee machines and
92*> when partial spectrum requests are made.
93*>
94*> Normal execution of SSTEMR may create NaNs and infinities and
95*> hence may abort due to a floating point exception in environments
96*> which do not handle NaNs and infinities in the ieee standard default
97*> manner.
98*> \endverbatim
99*
100* Arguments:
101* ==========
102*
103*> \param[in] JOBZ
104*> \verbatim
105*> JOBZ is CHARACTER*1
106*> = 'N': Compute eigenvalues only;
107*> = 'V': Compute eigenvalues and eigenvectors.
108*> \endverbatim
109*>
110*> \param[in] RANGE
111*> \verbatim
112*> RANGE is CHARACTER*1
113*> = 'A': all eigenvalues will be found.
114*> = 'V': all eigenvalues in the half-open interval (VL,VU]
115*> will be found.
116*> = 'I': the IL-th through IU-th eigenvalues will be found.
117*> For RANGE = 'V' or 'I' and IU - IL < N - 1, SSTEBZ and
118*> SSTEIN are called
119*> \endverbatim
120*>
121*> \param[in] UPLO
122*> \verbatim
123*> UPLO is CHARACTER*1
124*> = 'U': Upper triangle of A is stored;
125*> = 'L': Lower triangle of A is stored.
126*> \endverbatim
127*>
128*> \param[in] N
129*> \verbatim
130*> N is INTEGER
131*> The order of the matrix A. N >= 0.
132*> \endverbatim
133*>
134*> \param[in,out] A
135*> \verbatim
136*> A is REAL array, dimension (LDA, N)
137*> On entry, the symmetric matrix A. If UPLO = 'U', the
138*> leading N-by-N upper triangular part of A contains the
139*> upper triangular part of the matrix A. If UPLO = 'L',
140*> the leading N-by-N lower triangular part of A contains
141*> the lower triangular part of the matrix A.
142*> On exit, the lower triangle (if UPLO='L') or the upper
143*> triangle (if UPLO='U') of A, including the diagonal, is
144*> destroyed.
145*> \endverbatim
146*>
147*> \param[in] LDA
148*> \verbatim
149*> LDA is INTEGER
150*> The leading dimension of the array A. LDA >= max(1,N).
151*> \endverbatim
152*>
153*> \param[in] VL
154*> \verbatim
155*> VL is REAL
156*> If RANGE='V', the lower bound of the interval to
157*> be searched for eigenvalues. VL < VU.
158*> Not referenced if RANGE = 'A' or 'I'.
159*> \endverbatim
160*>
161*> \param[in] VU
162*> \verbatim
163*> VU is REAL
164*> If RANGE='V', the upper bound of the interval to
165*> be searched for eigenvalues. VL < VU.
166*> Not referenced if RANGE = 'A' or 'I'.
167*> \endverbatim
168*>
169*> \param[in] IL
170*> \verbatim
171*> IL is INTEGER
172*> If RANGE='I', the index of the
173*> smallest eigenvalue to be returned.
174*> 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
175*> Not referenced if RANGE = 'A' or 'V'.
176*> \endverbatim
177*>
178*> \param[in] IU
179*> \verbatim
180*> IU is INTEGER
181*> If RANGE='I', the index of the
182*> largest eigenvalue to be returned.
183*> 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
184*> Not referenced if RANGE = 'A' or 'V'.
185*> \endverbatim
186*>
187*> \param[in] ABSTOL
188*> \verbatim
189*> ABSTOL is REAL
190*> The absolute error tolerance for the eigenvalues.
191*> An approximate eigenvalue is accepted as converged
192*> when it is determined to lie in an interval [a,b]
193*> of width less than or equal to
194*>
195*> ABSTOL + EPS * max( |a|,|b| ) ,
196*>
197*> where EPS is the machine precision. If ABSTOL is less than
198*> or equal to zero, then EPS*|T| will be used in its place,
199*> where |T| is the 1-norm of the tridiagonal matrix obtained
200*> by reducing A to tridiagonal form.
201*>
202*> See "Computing Small Singular Values of Bidiagonal Matrices
203*> with Guaranteed High Relative Accuracy," by Demmel and
204*> Kahan, LAPACK Working Note #3.
205*>
206*> If high relative accuracy is important, set ABSTOL to
207*> SLAMCH( 'Safe minimum' ). Doing so will guarantee that
208*> eigenvalues are computed to high relative accuracy when
209*> possible in future releases. The current code does not
210*> make any guarantees about high relative accuracy, but
211*> future releases will. See J. Barlow and J. Demmel,
212*> "Computing Accurate Eigensystems of Scaled Diagonally
213*> Dominant Matrices", LAPACK Working Note #7, for a discussion
214*> of which matrices define their eigenvalues to high relative
215*> accuracy.
216*> \endverbatim
217*>
218*> \param[out] M
219*> \verbatim
220*> M is INTEGER
221*> The total number of eigenvalues found. 0 <= M <= N.
222*> If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1.
223*> \endverbatim
224*>
225*> \param[out] W
226*> \verbatim
227*> W is REAL array, dimension (N)
228*> The first M elements contain the selected eigenvalues in
229*> ascending order.
230*> \endverbatim
231*>
232*> \param[out] Z
233*> \verbatim
234*> Z is REAL array, dimension (LDZ, max(1,M))
235*> If JOBZ = 'V', then if INFO = 0, the first M columns of Z
236*> contain the orthonormal eigenvectors of the matrix A
237*> corresponding to the selected eigenvalues, with the i-th
238*> column of Z holding the eigenvector associated with W(i).
239*> If JOBZ = 'N', then Z is not referenced.
240*> Note: the user must ensure that at least max(1,M) columns are
241*> supplied in the array Z; if RANGE = 'V', the exact value of M
242*> is not known in advance and an upper bound must be used.
243*> Supplying N columns is always safe.
244*> \endverbatim
245*>
246*> \param[in] LDZ
247*> \verbatim
248*> LDZ is INTEGER
249*> The leading dimension of the array Z. LDZ >= 1, and if
250*> JOBZ = 'V', LDZ >= max(1,N).
251*> \endverbatim
252*>
253*> \param[out] ISUPPZ
254*> \verbatim
255*> ISUPPZ is INTEGER array, dimension ( 2*max(1,M) )
256*> The support of the eigenvectors in Z, i.e., the indices
257*> indicating the nonzero elements in Z. The i-th eigenvector
258*> is nonzero only in elements ISUPPZ( 2*i-1 ) through
259*> ISUPPZ( 2*i ). This is an output of SSTEMR (tridiagonal
260*> matrix). The support of the eigenvectors of A is typically
261*> 1:N because of the orthogonal transformations applied by SORMTR.
262*> Implemented only for RANGE = 'A' or 'I' and IU - IL = N - 1
263*> \endverbatim
264*>
265*> \param[out] WORK
266*> \verbatim
267*> WORK is REAL array, dimension (MAX(1,LWORK))
268*> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
269*> \endverbatim
270*>
271*> \param[in] LWORK
272*> \verbatim
273*> LWORK is INTEGER
274*> The dimension of the array WORK. LWORK >= max(1,26*N).
275*> For optimal efficiency, LWORK >= (NB+6)*N,
276*> where NB is the max of the blocksize for SSYTRD and SORMTR
277*> returned by ILAENV.
278*>
279*> If LWORK = -1, then a workspace query is assumed; the routine
280*> only calculates the optimal sizes of the WORK and IWORK
281*> arrays, returns these values as the first entries of the WORK
282*> and IWORK arrays, and no error message related to LWORK or
283*> LIWORK is issued by XERBLA.
284*> \endverbatim
285*>
286*> \param[out] IWORK
287*> \verbatim
288*> IWORK is INTEGER array, dimension (MAX(1,LIWORK))
289*> On exit, if INFO = 0, IWORK(1) returns the optimal LWORK.
290*> \endverbatim
291*>
292*> \param[in] LIWORK
293*> \verbatim
294*> LIWORK is INTEGER
295*> The dimension of the array IWORK. LIWORK >= max(1,10*N).
296*>
297*> If LIWORK = -1, then a workspace query is assumed; the
298*> routine only calculates the optimal sizes of the WORK and
299*> IWORK arrays, returns these values as the first entries of
300*> the WORK and IWORK arrays, and no error message related to
301*> LWORK or LIWORK is issued by XERBLA.
302*> \endverbatim
303*>
304*> \param[out] INFO
305*> \verbatim
306*> INFO is INTEGER
307*> = 0: successful exit
308*> < 0: if INFO = -i, the i-th argument had an illegal value
309*> > 0: Internal error
310*> \endverbatim
311*
312* Authors:
313* ========
314*
315*> \author Univ. of Tennessee
316*> \author Univ. of California Berkeley
317*> \author Univ. of Colorado Denver
318*> \author NAG Ltd.
319*
320*> \ingroup heevr
321*
322*> \par Contributors:
323* ==================
324*>
325*> Inderjit Dhillon, IBM Almaden, USA \n
326*> Osni Marques, LBNL/NERSC, USA \n
327*> Ken Stanley, Computer Science Division, University of
328*> California at Berkeley, USA \n
329*> Jason Riedy, Computer Science Division, University of
330*> California at Berkeley, USA \n
331*>
332* =====================================================================
333 SUBROUTINE ssyevr( JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL, IU,
334 $ ABSTOL, M, W, Z, LDZ, ISUPPZ, WORK, LWORK,
335 $ IWORK, LIWORK, INFO )
336*
337* -- LAPACK driver routine --
338* -- LAPACK is a software package provided by Univ. of Tennessee, --
339* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
340*
341* .. Scalar Arguments ..
342 CHARACTER JOBZ, RANGE, UPLO
343 INTEGER IL, INFO, IU, LDA, LDZ, LIWORK, LWORK, M, N
344 REAL ABSTOL, VL, VU
345* ..
346* .. Array Arguments ..
347 INTEGER ISUPPZ( * ), IWORK( * )
348 REAL A( LDA, * ), W( * ), WORK( * ), Z( LDZ, * )
349* ..
350*
351* =====================================================================
352*
353* .. Parameters ..
354 REAL ZERO, ONE, TWO
355 PARAMETER ( ZERO = 0.0e+0, one = 1.0e+0, two = 2.0e+0 )
356* ..
357* .. Local Scalars ..
358 LOGICAL ALLEIG, INDEIG, LOWER, LQUERY, TEST, VALEIG,
359 $ WANTZ, TRYRAC
360 CHARACTER ORDER
361 INTEGER I, IEEEOK, IINFO, IMAX, INDD, INDDD, INDE,
362 $ indee, indibl, indifl, indisp, indiwo, indtau,
363 $ indwk, indwkn, iscale, j, jj, liwmin,
364 $ llwork, llwrkn, lwkopt, lwmin, nb, nsplit
365 REAL ABSTLL, ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN,
366 $ SIGMA, SMLNUM, TMP1, VLL, VUU
367* ..
368* .. External Functions ..
369 LOGICAL LSAME
370 INTEGER ILAENV
371 REAL SLAMCH, SLANSY, SROUNDUP_LWORK
372 EXTERNAL lsame, ilaenv, slamch, slansy, sroundup_lwork
373* ..
374* .. External Subroutines ..
375 EXTERNAL scopy, sormtr, sscal, sstebz, sstemr, sstein,
377* ..
378* .. Intrinsic Functions ..
379 INTRINSIC max, min, sqrt
380* ..
381* .. Executable Statements ..
382*
383* Test the input parameters.
384*
385 ieeeok = ilaenv( 10, 'SSYEVR', 'N', 1, 2, 3, 4 )
386*
387 lower = lsame( uplo, 'L' )
388 wantz = lsame( jobz, 'V' )
389 alleig = lsame( range, 'A' )
390 valeig = lsame( range, 'V' )
391 indeig = lsame( range, 'I' )
392*
393 lquery = ( ( lwork.EQ.-1 ) .OR. ( liwork.EQ.-1 ) )
394*
395 lwmin = max( 1, 26*n )
396 liwmin = max( 1, 10*n )
397*
398 info = 0
399 IF( .NOT.( wantz .OR. lsame( jobz, 'N' ) ) ) THEN
400 info = -1
401 ELSE IF( .NOT.( alleig .OR. valeig .OR. indeig ) ) THEN
402 info = -2
403 ELSE IF( .NOT.( lower .OR. lsame( uplo, 'U' ) ) ) THEN
404 info = -3
405 ELSE IF( n.LT.0 ) THEN
406 info = -4
407 ELSE IF( lda.LT.max( 1, n ) ) THEN
408 info = -6
409 ELSE
410 IF( valeig ) THEN
411 IF( n.GT.0 .AND. vu.LE.vl )
412 $ info = -8
413 ELSE IF( indeig ) THEN
414 IF( il.LT.1 .OR. il.GT.max( 1, n ) ) THEN
415 info = -9
416 ELSE IF( iu.LT.min( n, il ) .OR. iu.GT.n ) THEN
417 info = -10
418 END IF
419 END IF
420 END IF
421 IF( info.EQ.0 ) THEN
422 IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) ) THEN
423 info = -15
424 END IF
425 END IF
426*
427 IF( info.EQ.0 ) THEN
428 nb = ilaenv( 1, 'SSYTRD', uplo, n, -1, -1, -1 )
429 nb = max( nb, ilaenv( 1, 'SORMTR', uplo, n, -1, -1, -1 ) )
430 lwkopt = max( ( nb+1 )*n, lwmin )
431 work( 1 ) = sroundup_lwork(lwkopt)
432 iwork( 1 ) = liwmin
433*
434 IF( lwork.LT.lwmin .AND. .NOT.lquery ) THEN
435 info = -18
436 ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery ) THEN
437 info = -20
438 END IF
439 END IF
440*
441 IF( info.NE.0 ) THEN
442 CALL xerbla( 'SSYEVR', -info )
443 RETURN
444 ELSE IF( lquery ) THEN
445 RETURN
446 END IF
447*
448* Quick return if possible
449*
450 m = 0
451 IF( n.EQ.0 ) THEN
452 work( 1 ) = 1
453 RETURN
454 END IF
455*
456 IF( n.EQ.1 ) THEN
457 work( 1 ) = 26
458 IF( alleig .OR. indeig ) THEN
459 m = 1
460 w( 1 ) = a( 1, 1 )
461 ELSE
462 IF( vl.LT.a( 1, 1 ) .AND. vu.GE.a( 1, 1 ) ) THEN
463 m = 1
464 w( 1 ) = a( 1, 1 )
465 END IF
466 END IF
467 IF( wantz ) THEN
468 z( 1, 1 ) = one
469 isuppz( 1 ) = 1
470 isuppz( 2 ) = 1
471 END IF
472 RETURN
473 END IF
474*
475* Get machine constants.
476*
477 safmin = slamch( 'Safe minimum' )
478 eps = slamch( 'Precision' )
479 smlnum = safmin / eps
480 bignum = one / smlnum
481 rmin = sqrt( smlnum )
482 rmax = min( sqrt( bignum ), one / sqrt( sqrt( safmin ) ) )
483*
484* Scale matrix to allowable range, if necessary.
485*
486 iscale = 0
487 abstll = abstol
488 IF (valeig) THEN
489 vll = vl
490 vuu = vu
491 END IF
492 anrm = slansy( 'M', uplo, n, a, lda, work )
493 IF( anrm.GT.zero .AND. anrm.LT.rmin ) THEN
494 iscale = 1
495 sigma = rmin / anrm
496 ELSE IF( anrm.GT.rmax ) THEN
497 iscale = 1
498 sigma = rmax / anrm
499 END IF
500 IF( iscale.EQ.1 ) THEN
501 IF( lower ) THEN
502 DO 10 j = 1, n
503 CALL sscal( n-j+1, sigma, a( j, j ), 1 )
504 10 CONTINUE
505 ELSE
506 DO 20 j = 1, n
507 CALL sscal( j, sigma, a( 1, j ), 1 )
508 20 CONTINUE
509 END IF
510 IF( abstol.GT.0 )
511 $ abstll = abstol*sigma
512 IF( valeig ) THEN
513 vll = vl*sigma
514 vuu = vu*sigma
515 END IF
516 END IF
517
518* Initialize indices into workspaces. Note: The IWORK indices are
519* used only if SSTERF or SSTEMR fail.
520
521* WORK(INDTAU:INDTAU+N-1) stores the scalar factors of the
522* elementary reflectors used in SSYTRD.
523 indtau = 1
524* WORK(INDD:INDD+N-1) stores the tridiagonal's diagonal entries.
525 indd = indtau + n
526* WORK(INDE:INDE+N-1) stores the off-diagonal entries of the
527* tridiagonal matrix from SSYTRD.
528 inde = indd + n
529* WORK(INDDD:INDDD+N-1) is a copy of the diagonal entries over
530* -written by SSTEMR (the SSTERF path copies the diagonal to W).
531 inddd = inde + n
532* WORK(INDEE:INDEE+N-1) is a copy of the off-diagonal entries over
533* -written while computing the eigenvalues in SSTERF and SSTEMR.
534 indee = inddd + n
535* INDWK is the starting offset of the left-over workspace, and
536* LLWORK is the remaining workspace size.
537 indwk = indee + n
538 llwork = lwork - indwk + 1
539
540* IWORK(INDIBL:INDIBL+M-1) corresponds to IBLOCK in SSTEBZ and
541* stores the block indices of each of the M<=N eigenvalues.
542 indibl = 1
543* IWORK(INDISP:INDISP+NSPLIT-1) corresponds to ISPLIT in SSTEBZ and
544* stores the starting and finishing indices of each block.
545 indisp = indibl + n
546* IWORK(INDIFL:INDIFL+N-1) stores the indices of eigenvectors
547* that corresponding to eigenvectors that fail to converge in
548* SSTEIN. This information is discarded; if any fail, the driver
549* returns INFO > 0.
550 indifl = indisp + n
551* INDIWO is the offset of the remaining integer workspace.
552 indiwo = indifl + n
553
554*
555* Call SSYTRD to reduce symmetric matrix to tridiagonal form.
556*
557 CALL ssytrd( uplo, n, a, lda, work( indd ), work( inde ),
558 $ work( indtau ), work( indwk ), llwork, iinfo )
559*
560* If all eigenvalues are desired
561* then call SSTERF or SSTEMR and SORMTR.
562*
563 test = .false.
564 IF( indeig ) THEN
565 IF( il.EQ.1 .AND. iu.EQ.n ) THEN
566 test = .true.
567 END IF
568 END IF
569 IF( ( alleig.OR.test ) .AND. ( ieeeok.EQ.1 ) ) THEN
570 IF( .NOT.wantz ) THEN
571 CALL scopy( n, work( indd ), 1, w, 1 )
572 CALL scopy( n-1, work( inde ), 1, work( indee ), 1 )
573 CALL ssterf( n, w, work( indee ), info )
574 ELSE
575 CALL scopy( n-1, work( inde ), 1, work( indee ), 1 )
576 CALL scopy( n, work( indd ), 1, work( inddd ), 1 )
577*
578 IF (abstol .LE. two*n*eps) THEN
579 tryrac = .true.
580 ELSE
581 tryrac = .false.
582 END IF
583 CALL sstemr( jobz, 'A', n, work( inddd ), work( indee ),
584 $ vl, vu, il, iu, m, w, z, ldz, n, isuppz,
585 $ tryrac, work( indwk ), lwork, iwork, liwork,
586 $ info )
587*
588*
589*
590* Apply orthogonal matrix used in reduction to tridiagonal
591* form to eigenvectors returned by SSTEMR.
592*
593 IF( wantz .AND. info.EQ.0 ) THEN
594 indwkn = inde
595 llwrkn = lwork - indwkn + 1
596 CALL sormtr( 'L', uplo, 'N', n, m, a, lda,
597 $ work( indtau ), z, ldz, work( indwkn ),
598 $ llwrkn, iinfo )
599 END IF
600 END IF
601*
602*
603 IF( info.EQ.0 ) THEN
604* Everything worked. Skip SSTEBZ/SSTEIN. IWORK(:) are
605* undefined.
606 m = n
607 GO TO 30
608 END IF
609 info = 0
610 END IF
611*
612* Otherwise, call SSTEBZ and, if eigenvectors are desired, SSTEIN.
613* Also call SSTEBZ and SSTEIN if SSTEMR fails.
614*
615 IF( wantz ) THEN
616 order = 'B'
617 ELSE
618 order = 'E'
619 END IF
620
621 CALL sstebz( range, order, n, vll, vuu, il, iu, abstll,
622 $ work( indd ), work( inde ), m, nsplit, w,
623 $ iwork( indibl ), iwork( indisp ), work( indwk ),
624 $ iwork( indiwo ), info )
625*
626 IF( wantz ) THEN
627 CALL sstein( n, work( indd ), work( inde ), m, w,
628 $ iwork( indibl ), iwork( indisp ), z, ldz,
629 $ work( indwk ), iwork( indiwo ), iwork( indifl ),
630 $ info )
631*
632* Apply orthogonal matrix used in reduction to tridiagonal
633* form to eigenvectors returned by SSTEIN.
634*
635 indwkn = inde
636 llwrkn = lwork - indwkn + 1
637 CALL sormtr( 'L', uplo, 'N', n, m, a, lda, work( indtau ), z,
638 $ ldz, work( indwkn ), llwrkn, iinfo )
639 END IF
640*
641* If matrix was scaled, then rescale eigenvalues appropriately.
642*
643* Jump here if SSTEMR/SSTEIN succeeded.
644 30 CONTINUE
645 IF( iscale.EQ.1 ) THEN
646 IF( info.EQ.0 ) THEN
647 imax = m
648 ELSE
649 imax = info - 1
650 END IF
651 CALL sscal( imax, one / sigma, w, 1 )
652 END IF
653*
654* If eigenvalues are not in order, then sort them, along with
655* eigenvectors. Note: We do not sort the IFAIL portion of IWORK.
656* It may not be initialized (if SSTEMR/SSTEIN succeeded), and we do
657* not return this detailed information to the user.
658*
659 IF( wantz ) THEN
660 DO 50 j = 1, m - 1
661 i = 0
662 tmp1 = w( j )
663 DO 40 jj = j + 1, m
664 IF( w( jj ).LT.tmp1 ) THEN
665 i = jj
666 tmp1 = w( jj )
667 END IF
668 40 CONTINUE
669*
670 IF( i.NE.0 ) THEN
671 w( i ) = w( j )
672 w( j ) = tmp1
673 CALL sswap( n, z( 1, i ), 1, z( 1, j ), 1 )
674 END IF
675 50 CONTINUE
676 END IF
677*
678* Set WORK(1) to optimal workspace size.
679*
680 work( 1 ) = sroundup_lwork(lwkopt)
681 iwork( 1 ) = liwmin
682*
683 RETURN
684*
685* End of SSYEVR
686*
687 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine scopy(n, sx, incx, sy, incy)
SCOPY
Definition scopy.f:82
subroutine ssyevr(jobz, range, uplo, n, a, lda, vl, vu, il, iu, abstol, m, w, z, ldz, isuppz, work, lwork, iwork, liwork, info)
SSYEVR computes the eigenvalues and, optionally, the left and/or right eigenvectors for SY matrices
Definition ssyevr.f:336
subroutine ssytrd(uplo, n, a, lda, d, e, tau, work, lwork, info)
SSYTRD
Definition ssytrd.f:192
subroutine sscal(n, sa, sx, incx)
SSCAL
Definition sscal.f:79
subroutine sstebz(range, order, n, vl, vu, il, iu, abstol, d, e, m, nsplit, w, iblock, isplit, work, iwork, info)
SSTEBZ
Definition sstebz.f:273
subroutine sstein(n, d, e, m, w, iblock, isplit, z, ldz, work, iwork, ifail, info)
SSTEIN
Definition sstein.f:174
subroutine sstemr(jobz, range, n, d, e, vl, vu, il, iu, m, w, z, ldz, nzc, isuppz, tryrac, work, lwork, iwork, liwork, info)
SSTEMR
Definition sstemr.f:322
subroutine ssterf(n, d, e, info)
SSTERF
Definition ssterf.f:86
subroutine sswap(n, sx, incx, sy, incy)
SSWAP
Definition sswap.f:82
subroutine sormtr(side, uplo, trans, m, n, a, lda, tau, c, ldc, work, lwork, info)
SORMTR
Definition sormtr.f:172