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