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

DSYGS2 reduces a symmetric definite generalized eigenproblem to standard form, using the factorization results obtained from spotrf (unblocked algorithm).

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

Purpose:
 DSYGS2 reduces a real symmetric-definite generalized eigenproblem
 to standard form.

 If ITYPE = 1, the problem is A*x = lambda*B*x,
 and A is overwritten by inv(U**T)*A*inv(U) or inv(L)*A*inv(L**T)

 If ITYPE = 2 or 3, the problem is A*B*x = lambda*x or
 B*A*x = lambda*x, and A is overwritten by U*A*U**T or L**T *A*L.

 B must have been previously factorized as U**T *U or L*L**T by DPOTRF.
Parameters
[in]ITYPE
          ITYPE is INTEGER
          = 1: compute inv(U**T)*A*inv(U) or inv(L)*A*inv(L**T);
          = 2 or 3: compute U*A*U**T or L**T *A*L.
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          symmetric matrix A is stored, and how B has been factorized.
          = 'U':  Upper triangular
          = 'L':  Lower triangular
[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, and the strictly lower
          triangular part of A is not referenced.  If UPLO = 'L', the
          leading n by n lower triangular part of A contains the lower
          triangular part of the matrix A, and the strictly upper
          triangular part of A is not referenced.

          On exit, if INFO = 0, the transformed matrix, stored in the
          same format as A.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[in]B
          B is DOUBLE PRECISION array, dimension (LDB,N)
          The triangular factor from the Cholesky factorization of B,
          as returned by DPOTRF.
[in]LDB
          LDB is INTEGER
          The leading dimension of the array B.  LDB >= max(1,N).
[out]INFO
          INFO is INTEGER
          = 0:  successful exit.
          < 0:  if INFO = -i, the i-th argument had an illegal value.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
September 2012

Definition at line 129 of file dsygs2.f.

129 *
130 * -- LAPACK computational routine (version 3.4.2) --
131 * -- LAPACK is a software package provided by Univ. of Tennessee, --
132 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
133 * September 2012
134 *
135 * .. Scalar Arguments ..
136  CHARACTER uplo
137  INTEGER info, itype, lda, ldb, n
138 * ..
139 * .. Array Arguments ..
140  DOUBLE PRECISION a( lda, * ), b( ldb, * )
141 * ..
142 *
143 * =====================================================================
144 *
145 * .. Parameters ..
146  DOUBLE PRECISION one, half
147  parameter ( one = 1.0d0, half = 0.5d0 )
148 * ..
149 * .. Local Scalars ..
150  LOGICAL upper
151  INTEGER k
152  DOUBLE PRECISION akk, bkk, ct
153 * ..
154 * .. External Subroutines ..
155  EXTERNAL daxpy, dscal, dsyr2, dtrmv, dtrsv, xerbla
156 * ..
157 * .. Intrinsic Functions ..
158  INTRINSIC max
159 * ..
160 * .. External Functions ..
161  LOGICAL lsame
162  EXTERNAL lsame
163 * ..
164 * .. Executable Statements ..
165 *
166 * Test the input parameters.
167 *
168  info = 0
169  upper = lsame( uplo, 'U' )
170  IF( itype.LT.1 .OR. itype.GT.3 ) THEN
171  info = -1
172  ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
173  info = -2
174  ELSE IF( n.LT.0 ) THEN
175  info = -3
176  ELSE IF( lda.LT.max( 1, n ) ) THEN
177  info = -5
178  ELSE IF( ldb.LT.max( 1, n ) ) THEN
179  info = -7
180  END IF
181  IF( info.NE.0 ) THEN
182  CALL xerbla( 'DSYGS2', -info )
183  RETURN
184  END IF
185 *
186  IF( itype.EQ.1 ) THEN
187  IF( upper ) THEN
188 *
189 * Compute inv(U**T)*A*inv(U)
190 *
191  DO 10 k = 1, n
192 *
193 * Update the upper triangle of A(k:n,k:n)
194 *
195  akk = a( k, k )
196  bkk = b( k, k )
197  akk = akk / bkk**2
198  a( k, k ) = akk
199  IF( k.LT.n ) THEN
200  CALL dscal( n-k, one / bkk, a( k, k+1 ), lda )
201  ct = -half*akk
202  CALL daxpy( n-k, ct, b( k, k+1 ), ldb, a( k, k+1 ),
203  $ lda )
204  CALL dsyr2( uplo, n-k, -one, a( k, k+1 ), lda,
205  $ b( k, k+1 ), ldb, a( k+1, k+1 ), lda )
206  CALL daxpy( n-k, ct, b( k, k+1 ), ldb, a( k, k+1 ),
207  $ lda )
208  CALL dtrsv( uplo, 'Transpose', 'Non-unit', n-k,
209  $ b( k+1, k+1 ), ldb, a( k, k+1 ), lda )
210  END IF
211  10 CONTINUE
212  ELSE
213 *
214 * Compute inv(L)*A*inv(L**T)
215 *
216  DO 20 k = 1, n
217 *
218 * Update the lower triangle of A(k:n,k:n)
219 *
220  akk = a( k, k )
221  bkk = b( k, k )
222  akk = akk / bkk**2
223  a( k, k ) = akk
224  IF( k.LT.n ) THEN
225  CALL dscal( n-k, one / bkk, a( k+1, k ), 1 )
226  ct = -half*akk
227  CALL daxpy( n-k, ct, b( k+1, k ), 1, a( k+1, k ), 1 )
228  CALL dsyr2( uplo, n-k, -one, a( k+1, k ), 1,
229  $ b( k+1, k ), 1, a( k+1, k+1 ), lda )
230  CALL daxpy( n-k, ct, b( k+1, k ), 1, a( k+1, k ), 1 )
231  CALL dtrsv( uplo, 'No transpose', 'Non-unit', n-k,
232  $ b( k+1, k+1 ), ldb, a( k+1, k ), 1 )
233  END IF
234  20 CONTINUE
235  END IF
236  ELSE
237  IF( upper ) THEN
238 *
239 * Compute U*A*U**T
240 *
241  DO 30 k = 1, n
242 *
243 * Update the upper triangle of A(1:k,1:k)
244 *
245  akk = a( k, k )
246  bkk = b( k, k )
247  CALL dtrmv( uplo, 'No transpose', 'Non-unit', k-1, b,
248  $ ldb, a( 1, k ), 1 )
249  ct = half*akk
250  CALL daxpy( k-1, ct, b( 1, k ), 1, a( 1, k ), 1 )
251  CALL dsyr2( uplo, k-1, one, a( 1, k ), 1, b( 1, k ), 1,
252  $ a, lda )
253  CALL daxpy( k-1, ct, b( 1, k ), 1, a( 1, k ), 1 )
254  CALL dscal( k-1, bkk, a( 1, k ), 1 )
255  a( k, k ) = akk*bkk**2
256  30 CONTINUE
257  ELSE
258 *
259 * Compute L**T *A*L
260 *
261  DO 40 k = 1, n
262 *
263 * Update the lower triangle of A(1:k,1:k)
264 *
265  akk = a( k, k )
266  bkk = b( k, k )
267  CALL dtrmv( uplo, 'Transpose', 'Non-unit', k-1, b, ldb,
268  $ a( k, 1 ), lda )
269  ct = half*akk
270  CALL daxpy( k-1, ct, b( k, 1 ), ldb, a( k, 1 ), lda )
271  CALL dsyr2( uplo, k-1, one, a( k, 1 ), lda, b( k, 1 ),
272  $ ldb, a, lda )
273  CALL daxpy( k-1, ct, b( k, 1 ), ldb, a( k, 1 ), lda )
274  CALL dscal( k-1, bkk, a( k, 1 ), lda )
275  a( k, k ) = akk*bkk**2
276  40 CONTINUE
277  END IF
278  END IF
279  RETURN
280 *
281 * End of DSYGS2
282 *
subroutine daxpy(N, DA, DX, INCX, DY, INCY)
DAXPY
Definition: daxpy.f:54
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine dscal(N, DA, DX, INCX)
DSCAL
Definition: dscal.f:55
subroutine dsyr2(UPLO, N, ALPHA, X, INCX, Y, INCY, A, LDA)
DSYR2
Definition: dsyr2.f:149
subroutine dtrmv(UPLO, TRANS, DIAG, N, A, LDA, X, INCX)
DTRMV
Definition: dtrmv.f:149
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine dtrsv(UPLO, TRANS, DIAG, N, A, LDA, X, INCX)
DTRSV
Definition: dtrsv.f:145

Here is the call graph for this function:

Here is the caller graph for this function: