LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
sspev.f
Go to the documentation of this file.
1*> \brief <b> SSPEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for OTHER matrices</b>
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download SSPEV + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sspev.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sspev.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sspev.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE SSPEV( JOBZ, UPLO, N, AP, W, Z, LDZ, WORK, INFO )
20*
21* .. Scalar Arguments ..
22* CHARACTER JOBZ, UPLO
23* INTEGER INFO, LDZ, N
24* ..
25* .. Array Arguments ..
26* REAL AP( * ), W( * ), WORK( * ), Z( LDZ, * )
27* ..
28*
29*
30*> \par Purpose:
31* =============
32*>
33*> \verbatim
34*>
35*> SSPEV computes all the eigenvalues and, optionally, eigenvectors of a
36*> real symmetric matrix A in packed storage.
37*> \endverbatim
38*
39* Arguments:
40* ==========
41*
42*> \param[in] JOBZ
43*> \verbatim
44*> JOBZ is CHARACTER*1
45*> = 'N': Compute eigenvalues only;
46*> = 'V': Compute eigenvalues and eigenvectors.
47*> \endverbatim
48*>
49*> \param[in] UPLO
50*> \verbatim
51*> UPLO is CHARACTER*1
52*> = 'U': Upper triangle of A is stored;
53*> = 'L': Lower triangle of A is stored.
54*> \endverbatim
55*>
56*> \param[in] N
57*> \verbatim
58*> N is INTEGER
59*> The order of the matrix A. N >= 0.
60*> \endverbatim
61*>
62*> \param[in,out] AP
63*> \verbatim
64*> AP is REAL array, dimension (N*(N+1)/2)
65*> On entry, the upper or lower triangle of the symmetric matrix
66*> A, packed columnwise in a linear array. The j-th column of A
67*> is stored in the array AP as follows:
68*> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
69*> if UPLO = 'L', AP(i + (j-1)*(2*n-j)/2) = A(i,j) for j<=i<=n.
70*>
71*> On exit, AP is overwritten by values generated during the
72*> reduction to tridiagonal form. If UPLO = 'U', the diagonal
73*> and first superdiagonal of the tridiagonal matrix T overwrite
74*> the corresponding elements of A, and if UPLO = 'L', the
75*> diagonal and first subdiagonal of T overwrite the
76*> corresponding elements of A.
77*> \endverbatim
78*>
79*> \param[out] W
80*> \verbatim
81*> W is REAL array, dimension (N)
82*> If INFO = 0, the eigenvalues in ascending order.
83*> \endverbatim
84*>
85*> \param[out] Z
86*> \verbatim
87*> Z is REAL array, dimension (LDZ, N)
88*> If JOBZ = 'V', then if INFO = 0, Z contains the orthonormal
89*> eigenvectors of the matrix A, with the i-th column of Z
90*> holding the eigenvector associated with W(i).
91*> If JOBZ = 'N', then Z is not referenced.
92*> \endverbatim
93*>
94*> \param[in] LDZ
95*> \verbatim
96*> LDZ is INTEGER
97*> The leading dimension of the array Z. LDZ >= 1, and if
98*> JOBZ = 'V', LDZ >= max(1,N).
99*> \endverbatim
100*>
101*> \param[out] WORK
102*> \verbatim
103*> WORK is REAL array, dimension (3*N)
104*> \endverbatim
105*>
106*> \param[out] INFO
107*> \verbatim
108*> INFO is INTEGER
109*> = 0: successful exit.
110*> < 0: if INFO = -i, the i-th argument had an illegal value.
111*> > 0: if INFO = i, the algorithm failed to converge; i
112*> off-diagonal elements of an intermediate tridiagonal
113*> form did not converge to zero.
114*> \endverbatim
115*
116* Authors:
117* ========
118*
119*> \author Univ. of Tennessee
120*> \author Univ. of California Berkeley
121*> \author Univ. of Colorado Denver
122*> \author NAG Ltd.
123*
124*> \ingroup hpev
125*
126* =====================================================================
127 SUBROUTINE sspev( JOBZ, UPLO, N, AP, W, Z, LDZ, WORK, INFO )
128*
129* -- LAPACK driver routine --
130* -- LAPACK is a software package provided by Univ. of Tennessee, --
131* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
132*
133* .. Scalar Arguments ..
134 CHARACTER JOBZ, UPLO
135 INTEGER INFO, LDZ, N
136* ..
137* .. Array Arguments ..
138 REAL AP( * ), W( * ), WORK( * ), Z( LDZ, * )
139* ..
140*
141* =====================================================================
142*
143* .. Parameters ..
144 REAL ZERO, ONE
145 parameter( zero = 0.0e0, one = 1.0e0 )
146* ..
147* .. Local Scalars ..
148 LOGICAL WANTZ
149 INTEGER IINFO, IMAX, INDE, INDTAU, INDWRK, ISCALE
150 REAL ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA,
151 $ SMLNUM
152* ..
153* .. External Functions ..
154 LOGICAL LSAME
155 REAL SLAMCH, SLANSP
156 EXTERNAL lsame, slamch, slansp
157* ..
158* .. External Subroutines ..
159 EXTERNAL sopgtr, sscal, ssptrd, ssteqr, ssterf,
160 $ xerbla
161* ..
162* .. Intrinsic Functions ..
163 INTRINSIC sqrt
164* ..
165* .. Executable Statements ..
166*
167* Test the input parameters.
168*
169 wantz = lsame( jobz, 'V' )
170*
171 info = 0
172 IF( .NOT.( wantz .OR. lsame( jobz, 'N' ) ) ) THEN
173 info = -1
174 ELSE IF( .NOT.( lsame( uplo, 'U' ) .OR.
175 $ lsame( uplo, 'L' ) ) )
176 $ THEN
177 info = -2
178 ELSE IF( n.LT.0 ) THEN
179 info = -3
180 ELSE IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) ) THEN
181 info = -7
182 END IF
183*
184 IF( info.NE.0 ) THEN
185 CALL xerbla( 'SSPEV ', -info )
186 RETURN
187 END IF
188*
189* Quick return if possible
190*
191 IF( n.EQ.0 )
192 $ RETURN
193*
194 IF( n.EQ.1 ) THEN
195 w( 1 ) = ap( 1 )
196 IF( wantz )
197 $ z( 1, 1 ) = one
198 RETURN
199 END IF
200*
201* Get machine constants.
202*
203 safmin = slamch( 'Safe minimum' )
204 eps = slamch( 'Precision' )
205 smlnum = safmin / eps
206 bignum = one / smlnum
207 rmin = sqrt( smlnum )
208 rmax = sqrt( bignum )
209*
210* Scale matrix to allowable range, if necessary.
211*
212 anrm = slansp( 'M', uplo, n, ap, work )
213 iscale = 0
214 IF( anrm.GT.zero .AND. anrm.LT.rmin ) THEN
215 iscale = 1
216 sigma = rmin / anrm
217 ELSE IF( anrm.GT.rmax ) THEN
218 iscale = 1
219 sigma = rmax / anrm
220 END IF
221 IF( iscale.EQ.1 ) THEN
222 CALL sscal( ( n*( n+1 ) ) / 2, sigma, ap, 1 )
223 END IF
224*
225* Call SSPTRD to reduce symmetric packed matrix to tridiagonal form.
226*
227 inde = 1
228 indtau = inde + n
229 CALL ssptrd( uplo, n, ap, w, work( inde ), work( indtau ),
230 $ iinfo )
231*
232* For eigenvalues only, call SSTERF. For eigenvectors, first call
233* SOPGTR to generate the orthogonal matrix, then call SSTEQR.
234*
235 IF( .NOT.wantz ) THEN
236 CALL ssterf( n, w, work( inde ), info )
237 ELSE
238 indwrk = indtau + n
239 CALL sopgtr( uplo, n, ap, work( indtau ), z, ldz,
240 $ work( indwrk ), iinfo )
241 CALL ssteqr( jobz, n, w, work( inde ), z, ldz,
242 $ work( indtau ),
243 $ info )
244 END IF
245*
246* If matrix was scaled, then rescale eigenvalues appropriately.
247*
248 IF( iscale.EQ.1 ) THEN
249 IF( info.EQ.0 ) THEN
250 imax = n
251 ELSE
252 imax = info - 1
253 END IF
254 CALL sscal( imax, one / sigma, w, 1 )
255 END IF
256*
257 RETURN
258*
259* End of SSPEV
260*
261 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine sspev(jobz, uplo, n, ap, w, z, ldz, work, info)
SSPEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for OTHER matrices
Definition sspev.f:128
subroutine ssptrd(uplo, n, ap, d, e, tau, info)
SSPTRD
Definition ssptrd.f:148
subroutine sscal(n, sa, sx, incx)
SSCAL
Definition sscal.f:79
subroutine ssteqr(compz, n, d, e, z, ldz, work, info)
SSTEQR
Definition ssteqr.f:129
subroutine ssterf(n, d, e, info)
SSTERF
Definition ssterf.f:84
subroutine sopgtr(uplo, n, ap, tau, q, ldq, work, info)
SOPGTR
Definition sopgtr.f:112