LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine dsygv ( integer  ITYPE,
character  JOBZ,
character  UPLO,
integer  N,
double precision, dimension( lda, * )  A,
integer  LDA,
double precision, dimension( ldb, * )  B,
integer  LDB,
double precision, dimension( * )  W,
double precision, dimension( * )  WORK,
integer  LWORK,
integer  INFO 
)

DSYGV

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

Purpose:
 DSYGV 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 DOUBLE PRECISION 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 DOUBLE PRECISION 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 DOUBLE PRECISION array, dimension (N)
          If INFO = 0, the eigenvalues in ascending order.
[out]WORK
          WORK is DOUBLE PRECISION 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 DSYTRD 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:  DPOTRF or DSYEV returned an error code:
             <= N:  if INFO = i, DSYEV 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
                    minor of order i of B is not positive definite.
                    The factorization of B could not be completed and
                    no eigenvalues or eigenvectors were computed.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2015

Definition at line 177 of file dsygv.f.

177 *
178 * -- LAPACK driver routine (version 3.6.0) --
179 * -- LAPACK is a software package provided by Univ. of Tennessee, --
180 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
181 * November 2015
182 *
183 * .. Scalar Arguments ..
184  CHARACTER jobz, uplo
185  INTEGER info, itype, lda, ldb, lwork, n
186 * ..
187 * .. Array Arguments ..
188  DOUBLE PRECISION a( lda, * ), b( ldb, * ), w( * ), work( * )
189 * ..
190 *
191 * =====================================================================
192 *
193 * .. Parameters ..
194  DOUBLE PRECISION one
195  parameter ( one = 1.0d+0 )
196 * ..
197 * .. Local Scalars ..
198  LOGICAL lquery, upper, wantz
199  CHARACTER trans
200  INTEGER lwkmin, lwkopt, nb, neig
201 * ..
202 * .. External Functions ..
203  LOGICAL lsame
204  INTEGER ilaenv
205  EXTERNAL lsame, ilaenv
206 * ..
207 * .. External Subroutines ..
208  EXTERNAL dpotrf, dsyev, dsygst, dtrmm, dtrsm, xerbla
209 * ..
210 * .. Intrinsic Functions ..
211  INTRINSIC max
212 * ..
213 * .. Executable Statements ..
214 *
215 * Test the input parameters.
216 *
217  wantz = lsame( jobz, 'V' )
218  upper = lsame( uplo, 'U' )
219  lquery = ( lwork.EQ.-1 )
220 *
221  info = 0
222  IF( itype.LT.1 .OR. itype.GT.3 ) THEN
223  info = -1
224  ELSE IF( .NOT.( wantz .OR. lsame( jobz, 'N' ) ) ) THEN
225  info = -2
226  ELSE IF( .NOT.( upper .OR. lsame( uplo, 'L' ) ) ) THEN
227  info = -3
228  ELSE IF( n.LT.0 ) THEN
229  info = -4
230  ELSE IF( lda.LT.max( 1, n ) ) THEN
231  info = -6
232  ELSE IF( ldb.LT.max( 1, n ) ) THEN
233  info = -8
234  END IF
235 *
236  IF( info.EQ.0 ) THEN
237  lwkmin = max( 1, 3*n - 1 )
238  nb = ilaenv( 1, 'DSYTRD', uplo, n, -1, -1, -1 )
239  lwkopt = max( lwkmin, ( nb + 2 )*n )
240  work( 1 ) = lwkopt
241 *
242  IF( lwork.LT.lwkmin .AND. .NOT.lquery ) THEN
243  info = -11
244  END IF
245  END IF
246 *
247  IF( info.NE.0 ) THEN
248  CALL xerbla( 'DSYGV ', -info )
249  RETURN
250  ELSE IF( lquery ) THEN
251  RETURN
252  END IF
253 *
254 * Quick return if possible
255 *
256  IF( n.EQ.0 )
257  $ RETURN
258 *
259 * Form a Cholesky factorization of B.
260 *
261  CALL dpotrf( uplo, n, b, ldb, info )
262  IF( info.NE.0 ) THEN
263  info = n + info
264  RETURN
265  END IF
266 *
267 * Transform problem to standard eigenvalue problem and solve.
268 *
269  CALL dsygst( itype, uplo, n, a, lda, b, ldb, info )
270  CALL dsyev( jobz, uplo, n, a, lda, w, work, lwork, info )
271 *
272  IF( wantz ) THEN
273 *
274 * Backtransform eigenvectors to the original problem.
275 *
276  neig = n
277  IF( info.GT.0 )
278  $ neig = info - 1
279  IF( itype.EQ.1 .OR. itype.EQ.2 ) THEN
280 *
281 * For A*x=(lambda)*B*x and A*B*x=(lambda)*x;
282 * backtransform eigenvectors: x = inv(L)**T*y or inv(U)*y
283 *
284  IF( upper ) THEN
285  trans = 'N'
286  ELSE
287  trans = 'T'
288  END IF
289 *
290  CALL dtrsm( 'Left', uplo, trans, 'Non-unit', n, neig, one,
291  $ b, ldb, a, lda )
292 *
293  ELSE IF( itype.EQ.3 ) THEN
294 *
295 * For B*A*x=(lambda)*x;
296 * backtransform eigenvectors: x = L*y or U**T*y
297 *
298  IF( upper ) THEN
299  trans = 'T'
300  ELSE
301  trans = 'N'
302  END IF
303 *
304  CALL dtrmm( 'Left', uplo, trans, 'Non-unit', n, neig, one,
305  $ b, ldb, a, lda )
306  END IF
307  END IF
308 *
309  work( 1 ) = lwkopt
310  RETURN
311 *
312 * End of DSYGV
313 *
subroutine dtrsm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
DTRSM
Definition: dtrsm.f:183
subroutine dpotrf(UPLO, N, A, LDA, INFO)
DPOTRF
Definition: dpotrf.f:109
subroutine dsyev(JOBZ, UPLO, N, A, LDA, W, WORK, LWORK, INFO)
DSYEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for SY matrices ...
Definition: dsyev.f:134
subroutine dtrmm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
DTRMM
Definition: dtrmm.f:179
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
integer function ilaenv(ISPEC, NAME, OPTS, N1, N2, N3, N4)
Definition: tstiee.f:83
subroutine dsygst(ITYPE, UPLO, N, A, LDA, B, LDB, INFO)
DSYGST
Definition: dsygst.f:129
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the call graph for this function:

Here is the caller graph for this function: