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

## ◆ ssygv()

 subroutine ssygv ( integer itype, character jobz, character uplo, integer n, real, dimension( lda, * ) a, integer lda, real, dimension( ldb, * ) b, integer ldb, real, dimension( * ) w, real, dimension( * ) work, integer lwork, integer info )

SSYGV

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

Purpose:
``` SSYGV computes all the eigenvalues, and optionally, the eigenvectors
of a real generalized symmetric-definite eigenproblem, of the form
A*x=(lambda)*B*x,  A*Bx=(lambda)*x,  or B*A*x=(lambda)*x.
Here A and B are assumed to be symmetric and B is also
positive definite.```
Parameters
 [in] ITYPE ``` ITYPE is INTEGER Specifies the problem type to be solved: = 1: A*x = (lambda)*B*x = 2: A*B*x = (lambda)*x = 3: B*A*x = (lambda)*x``` [in] JOBZ ``` JOBZ is CHARACTER*1 = 'N': Compute eigenvalues only; = 'V': Compute eigenvalues and eigenvectors.``` [in] UPLO ``` UPLO is CHARACTER*1 = 'U': Upper triangles of A and B are stored; = 'L': Lower triangles of A and B are stored.``` [in] N ``` N is INTEGER The order of the matrices A and B. N >= 0.``` [in,out] A ``` A is REAL array, dimension (LDA, N) On entry, the symmetric matrix A. If UPLO = 'U', the leading N-by-N upper triangular part of A contains the upper triangular part of the matrix A. If UPLO = 'L', the leading N-by-N lower triangular part of A contains the lower triangular part of the matrix A. On exit, if JOBZ = 'V', then if INFO = 0, A contains the matrix Z of eigenvectors. The eigenvectors are normalized as follows: if ITYPE = 1 or 2, Z**T*B*Z = I; if ITYPE = 3, Z**T*inv(B)*Z = I. If JOBZ = 'N', then on exit the upper triangle (if UPLO='U') or the lower triangle (if UPLO='L') of A, including the diagonal, is destroyed.``` [in] LDA ``` LDA is INTEGER The leading dimension of the array A. LDA >= max(1,N).``` [in,out] B ``` B is REAL array, dimension (LDB, N) On entry, the symmetric positive definite matrix B. If UPLO = 'U', the leading N-by-N upper triangular part of B contains the upper triangular part of the matrix B. If UPLO = 'L', the leading N-by-N lower triangular part of B contains the lower triangular part of the matrix B. On exit, if INFO <= N, the part of B containing the matrix is overwritten by the triangular factor U or L from the Cholesky factorization B = U**T*U or B = L*L**T.``` [in] LDB ``` LDB is INTEGER The leading dimension of the array B. LDB >= max(1,N).``` [out] W ``` W is REAL array, dimension (N) If INFO = 0, the eigenvalues in ascending order.``` [out] WORK ``` WORK is REAL array, dimension (MAX(1,LWORK)) On exit, if INFO = 0, WORK(1) returns the optimal LWORK.``` [in] LWORK ``` LWORK is INTEGER The length of the array WORK. LWORK >= max(1,3*N-1). For optimal efficiency, LWORK >= (NB+2)*N, where NB is the blocksize for SSYTRD returned by ILAENV. If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK 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: SPOTRF or SSYEV returned an error code: <= N: if INFO = i, SSYEV failed to converge; i off-diagonal elements of an intermediate tridiagonal form did not converge to zero; > N: if INFO = N + i, for 1 <= i <= N, then the leading principal minor of order i of B is not positive. The factorization of B could not be completed and no eigenvalues or eigenvectors were computed.```

Definition at line 173 of file ssygv.f.

175*
176* -- LAPACK driver routine --
177* -- LAPACK is a software package provided by Univ. of Tennessee, --
178* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
179*
180* .. Scalar Arguments ..
181 CHARACTER JOBZ, UPLO
182 INTEGER INFO, ITYPE, LDA, LDB, LWORK, N
183* ..
184* .. Array Arguments ..
185 REAL A( LDA, * ), B( LDB, * ), W( * ), WORK( * )
186* ..
187*
188* =====================================================================
189*
190* .. Parameters ..
191 REAL ONE
192 parameter( one = 1.0e+0 )
193* ..
194* .. Local Scalars ..
195 LOGICAL LQUERY, UPPER, WANTZ
196 CHARACTER TRANS
197 INTEGER LWKMIN, LWKOPT, NB, NEIG
198* ..
199* .. External Functions ..
200 LOGICAL LSAME
201 INTEGER ILAENV
202 REAL SROUNDUP_LWORK
203 EXTERNAL ilaenv, lsame, sroundup_lwork
204* ..
205* .. External Subroutines ..
206 EXTERNAL spotrf, ssyev, ssygst, strmm, strsm, xerbla
207* ..
208* .. Intrinsic Functions ..
209 INTRINSIC max
210* ..
211* .. Executable Statements ..
212*
213* Test the input parameters.
214*
215 wantz = lsame( jobz, 'V' )
216 upper = lsame( uplo, 'U' )
217 lquery = ( lwork.EQ.-1 )
218*
219 info = 0
220 IF( itype.LT.1 .OR. itype.GT.3 ) THEN
221 info = -1
222 ELSE IF( .NOT.( wantz .OR. lsame( jobz, 'N' ) ) ) THEN
223 info = -2
224 ELSE IF( .NOT.( upper .OR. lsame( uplo, 'L' ) ) ) THEN
225 info = -3
226 ELSE IF( n.LT.0 ) THEN
227 info = -4
228 ELSE IF( lda.LT.max( 1, n ) ) THEN
229 info = -6
230 ELSE IF( ldb.LT.max( 1, n ) ) THEN
231 info = -8
232 END IF
233*
234 IF( info.EQ.0 ) THEN
235 lwkmin = max( 1, 3*n - 1 )
236 nb = ilaenv( 1, 'SSYTRD', uplo, n, -1, -1, -1 )
237 lwkopt = max( lwkmin, ( nb + 2 )*n )
238 work( 1 ) = sroundup_lwork(lwkopt)
239*
240 IF( lwork.LT.lwkmin .AND. .NOT.lquery ) THEN
241 info = -11
242 END IF
243 END IF
244*
245 IF( info.NE.0 ) THEN
246 CALL xerbla( 'SSYGV ', -info )
247 RETURN
248 ELSE IF( lquery ) THEN
249 RETURN
250 END IF
251*
252* Quick return if possible
253*
254 IF( n.EQ.0 )
255 \$ RETURN
256*
257* Form a Cholesky factorization of B.
258*
259 CALL spotrf( uplo, n, b, ldb, info )
260 IF( info.NE.0 ) THEN
261 info = n + info
262 RETURN
263 END IF
264*
265* Transform problem to standard eigenvalue problem and solve.
266*
267 CALL ssygst( itype, uplo, n, a, lda, b, ldb, info )
268 CALL ssyev( jobz, uplo, n, a, lda, w, work, lwork, info )
269*
270 IF( wantz ) THEN
271*
272* Backtransform eigenvectors to the original problem.
273*
274 neig = n
275 IF( info.GT.0 )
276 \$ neig = info - 1
277 IF( itype.EQ.1 .OR. itype.EQ.2 ) THEN
278*
279* For A*x=(lambda)*B*x and A*B*x=(lambda)*x;
280* backtransform eigenvectors: x = inv(L)**T*y or inv(U)*y
281*
282 IF( upper ) THEN
283 trans = 'N'
284 ELSE
285 trans = 'T'
286 END IF
287*
288 CALL strsm( 'Left', uplo, trans, 'Non-unit', n, neig, one,
289 \$ b, ldb, a, lda )
290*
291 ELSE IF( itype.EQ.3 ) THEN
292*
293* For B*A*x=(lambda)*x;
294* backtransform eigenvectors: x = L*y or U**T*y
295*
296 IF( upper ) THEN
297 trans = 'T'
298 ELSE
299 trans = 'N'
300 END IF
301*
302 CALL strmm( 'Left', uplo, trans, 'Non-unit', n, neig, one,
303 \$ b, ldb, a, lda )
304 END IF
305 END IF
306*
307 work( 1 ) = sroundup_lwork(lwkopt)
308 RETURN
309*
310* End of SSYGV
311*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine ssyev(jobz, uplo, n, a, lda, w, work, lwork, info)
SSYEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for SY matrices
Definition ssyev.f:132
subroutine ssygst(itype, uplo, n, a, lda, b, ldb, info)
SSYGST
Definition ssygst.f:127
integer function ilaenv(ispec, name, opts, n1, n2, n3, n4)
ILAENV
Definition ilaenv.f:162
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine spotrf(uplo, n, a, lda, info)
SPOTRF
Definition spotrf.f:107
real function sroundup_lwork(lwork)
SROUNDUP_LWORK
subroutine strmm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
STRMM
Definition strmm.f:177
subroutine strsm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
STRSM
Definition strsm.f:181
Here is the call graph for this function:
Here is the caller graph for this function: