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

◆ sspevd()

subroutine sspevd ( character jobz,
character uplo,
integer n,
real, dimension( * ) ap,
real, dimension( * ) w,
real, dimension( ldz, * ) z,
integer ldz,
real, dimension( * ) work,
integer lwork,
integer, dimension( * ) iwork,
integer liwork,
integer info )

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

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

Purpose:
!>
!> SSPEVD computes all the eigenvalues and, optionally, eigenvectors
!> of a real symmetric matrix A in packed storage. If eigenvectors are
!> desired, it uses a divide and conquer algorithm.
!>
!> 
Parameters
[in]JOBZ
!>          JOBZ is CHARACTER*1
!>          = 'N':  Compute eigenvalues only;
!>          = 'V':  Compute eigenvalues and eigenvectors.
!> 
[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]AP
!>          AP is REAL array, dimension (N*(N+1)/2)
!>          On entry, the upper or lower triangle of the symmetric matrix
!>          A, packed columnwise in a linear array.  The j-th column of A
!>          is stored in the array AP as follows:
!>          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
!>          if UPLO = 'L', AP(i + (j-1)*(2*n-j)/2) = A(i,j) for j<=i<=n.
!>
!>          On exit, AP is overwritten by values generated during the
!>          reduction to tridiagonal form.  If UPLO = 'U', the diagonal
!>          and first superdiagonal of the tridiagonal matrix T overwrite
!>          the corresponding elements of A, and if UPLO = 'L', the
!>          diagonal and first subdiagonal of T overwrite the
!>          corresponding elements of A.
!> 
[out]W
!>          W is REAL array, dimension (N)
!>          If INFO = 0, the eigenvalues in ascending order.
!> 
[out]Z
!>          Z is REAL 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 REAL array, dimension (MAX(1,LWORK))
!>          On exit, if INFO = 0, WORK(1) returns the required LWORK.
!> 
[in]LWORK
!>          LWORK is INTEGER
!>          The dimension of the array WORK.
!>          If N <= 1,               LWORK must be at least 1.
!>          If JOBZ = 'N' and N > 1, LWORK must be at least 2*N.
!>          If JOBZ = 'V' and N > 1, LWORK must be at least
!>                                                 1 + 6*N + N**2.
!>
!>          If LWORK = -1, then a workspace query is assumed; the routine
!>          only calculates the required sizes of the WORK and IWORK
!>          arrays, returns these values as the first entries of the WORK
!>          and IWORK arrays, and no error message related to LWORK or
!>          LIWORK is issued by XERBLA.
!> 
[out]IWORK
!>          IWORK is INTEGER array, dimension (MAX(1,LIWORK))
!>          On exit, if INFO = 0, IWORK(1) returns the required LIWORK.
!> 
[in]LIWORK
!>          LIWORK is INTEGER
!>          The dimension of the array IWORK.
!>          If JOBZ  = 'N' or N <= 1, LIWORK must be at least 1.
!>          If JOBZ  = 'V' and N > 1, LIWORK must be at least 3 + 5*N.
!>
!>          If LIWORK = -1, then a workspace query is assumed; the
!>          routine only calculates the required sizes of the WORK and
!>          IWORK arrays, returns these values as the first entries of
!>          the WORK and IWORK arrays, and no error message related to
!>          LWORK or LIWORK is issued by XERBLA.
!> 
[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.

Definition at line 168 of file sspevd.f.

170*
171* -- LAPACK driver routine --
172* -- LAPACK is a software package provided by Univ. of Tennessee, --
173* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
174*
175* .. Scalar Arguments ..
176 CHARACTER JOBZ, UPLO
177 INTEGER INFO, LDZ, LIWORK, LWORK, N
178* ..
179* .. Array Arguments ..
180 INTEGER IWORK( * )
181 REAL AP( * ), W( * ), WORK( * ), Z( LDZ, * )
182* ..
183*
184* =====================================================================
185*
186* .. Parameters ..
187 REAL ZERO, ONE
188 parameter( zero = 0.0e+0, one = 1.0e+0 )
189* ..
190* .. Local Scalars ..
191 LOGICAL LQUERY, WANTZ
192 INTEGER IINFO, INDE, INDTAU, INDWRK, ISCALE, LIWMIN,
193 $ LLWORK, LWMIN
194 REAL ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA,
195 $ SMLNUM
196* ..
197* .. External Functions ..
198 LOGICAL LSAME
199 REAL SLAMCH, SLANSP, SROUNDUP_LWORK
200 EXTERNAL lsame, slamch, slansp,
202* ..
203* .. External Subroutines ..
204 EXTERNAL sopmtr, sscal, ssptrd, sstedc, ssterf,
205 $ xerbla
206* ..
207* .. Intrinsic Functions ..
208 INTRINSIC sqrt
209* ..
210* .. Executable Statements ..
211*
212* Test the input parameters.
213*
214 wantz = lsame( jobz, 'V' )
215 lquery = ( lwork.EQ.-1 .OR. liwork.EQ.-1 )
216*
217 info = 0
218 IF( .NOT.( wantz .OR. lsame( jobz, 'N' ) ) ) THEN
219 info = -1
220 ELSE IF( .NOT.( lsame( uplo, 'U' ) .OR.
221 $ lsame( uplo, 'L' ) ) )
222 $ THEN
223 info = -2
224 ELSE IF( n.LT.0 ) THEN
225 info = -3
226 ELSE IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) ) THEN
227 info = -7
228 END IF
229*
230 IF( info.EQ.0 ) THEN
231 IF( n.LE.1 ) THEN
232 liwmin = 1
233 lwmin = 1
234 ELSE
235 IF( wantz ) THEN
236 liwmin = 3 + 5*n
237 lwmin = 1 + 6*n + n**2
238 ELSE
239 liwmin = 1
240 lwmin = 2*n
241 END IF
242 END IF
243 iwork( 1 ) = liwmin
244 work( 1 ) = sroundup_lwork(lwmin)
245*
246 IF( lwork.LT.lwmin .AND. .NOT.lquery ) THEN
247 info = -9
248 ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery ) THEN
249 info = -11
250 END IF
251 END IF
252*
253 IF( info.NE.0 ) THEN
254 CALL xerbla( 'SSPEVD', -info )
255 RETURN
256 ELSE IF( lquery ) THEN
257 RETURN
258 END IF
259*
260* Quick return if possible
261*
262 IF( n.EQ.0 )
263 $ RETURN
264*
265 IF( n.EQ.1 ) THEN
266 w( 1 ) = ap( 1 )
267 IF( wantz )
268 $ z( 1, 1 ) = one
269 RETURN
270 END IF
271*
272* Get machine constants.
273*
274 safmin = slamch( 'Safe minimum' )
275 eps = slamch( 'Precision' )
276 smlnum = safmin / eps
277 bignum = one / smlnum
278 rmin = sqrt( smlnum )
279 rmax = sqrt( bignum )
280*
281* Scale matrix to allowable range, if necessary.
282*
283 anrm = slansp( 'M', uplo, n, ap, work )
284 iscale = 0
285 IF( anrm.GT.zero .AND. anrm.LT.rmin ) THEN
286 iscale = 1
287 sigma = rmin / anrm
288 ELSE IF( anrm.GT.rmax ) THEN
289 iscale = 1
290 sigma = rmax / anrm
291 END IF
292 IF( iscale.EQ.1 ) THEN
293 CALL sscal( ( n*( n+1 ) ) / 2, sigma, ap, 1 )
294 END IF
295*
296* Call SSPTRD to reduce symmetric packed matrix to tridiagonal form.
297*
298 inde = 1
299 indtau = inde + n
300 CALL ssptrd( uplo, n, ap, w, work( inde ), work( indtau ),
301 $ iinfo )
302*
303* For eigenvalues only, call SSTERF. For eigenvectors, first call
304* SSTEDC to generate the eigenvector matrix, WORK(INDWRK), of the
305* tridiagonal matrix, then call SOPMTR to multiply it by the
306* Householder transformations represented in AP.
307*
308 IF( .NOT.wantz ) THEN
309 CALL ssterf( n, w, work( inde ), info )
310 ELSE
311 indwrk = indtau + n
312 llwork = lwork - indwrk + 1
313 CALL sstedc( 'I', n, w, work( inde ), z, ldz,
314 $ work( indwrk ),
315 $ llwork, iwork, liwork, info )
316 CALL sopmtr( 'L', uplo, 'N', n, n, ap, work( indtau ), z,
317 $ ldz,
318 $ work( indwrk ), iinfo )
319 END IF
320*
321* If matrix was scaled, then rescale eigenvalues appropriately.
322*
323 IF( iscale.EQ.1 )
324 $ CALL sscal( n, one / sigma, w, 1 )
325*
326 work( 1 ) = sroundup_lwork(lwmin)
327 iwork( 1 ) = liwmin
328 RETURN
329*
330* End of SSPEVD
331*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine ssptrd(uplo, n, ap, d, e, tau, info)
SSPTRD
Definition ssptrd.f:148
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
real function slansp(norm, uplo, n, ap, work)
SLANSP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition slansp.f:112
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 sstedc(compz, n, d, e, z, ldz, work, lwork, iwork, liwork, info)
SSTEDC
Definition sstedc.f:180
subroutine ssterf(n, d, e, info)
SSTERF
Definition ssterf.f:84
subroutine sopmtr(side, uplo, trans, m, n, ap, tau, c, ldc, work, info)
SOPMTR
Definition sopmtr.f:149
Here is the call graph for this function:
Here is the caller graph for this function: