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

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

Purpose:
``` SSYGS2 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 SPOTRF.```
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 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, 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 REAL array, dimension (LDB,N) The triangular factor from the Cholesky factorization of B, as returned by SPOTRF.``` [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.```
Date
September 2012

Definition at line 129 of file ssygs2.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  REAL a( lda, * ), b( ldb, * )
141 * ..
142 *
143 * =====================================================================
144 *
145 * .. Parameters ..
146  REAL one, half
147  parameter ( one = 1.0, half = 0.5 )
148 * ..
149 * .. Local Scalars ..
150  LOGICAL upper
151  INTEGER k
152  REAL akk, bkk, ct
153 * ..
154 * .. External Subroutines ..
155  EXTERNAL saxpy, sscal, ssyr2, strmv, strsv, 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( 'SSYGS2', -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 sscal( n-k, one / bkk, a( k, k+1 ), lda )
201  ct = -half*akk
202  CALL saxpy( n-k, ct, b( k, k+1 ), ldb, a( k, k+1 ),
203  \$ lda )
204  CALL ssyr2( uplo, n-k, -one, a( k, k+1 ), lda,
205  \$ b( k, k+1 ), ldb, a( k+1, k+1 ), lda )
206  CALL saxpy( n-k, ct, b( k, k+1 ), ldb, a( k, k+1 ),
207  \$ lda )
208  CALL strsv( 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 sscal( n-k, one / bkk, a( k+1, k ), 1 )
226  ct = -half*akk
227  CALL saxpy( n-k, ct, b( k+1, k ), 1, a( k+1, k ), 1 )
228  CALL ssyr2( uplo, n-k, -one, a( k+1, k ), 1,
229  \$ b( k+1, k ), 1, a( k+1, k+1 ), lda )
230  CALL saxpy( n-k, ct, b( k+1, k ), 1, a( k+1, k ), 1 )
231  CALL strsv( 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 strmv( uplo, 'No transpose', 'Non-unit', k-1, b,
248  \$ ldb, a( 1, k ), 1 )
249  ct = half*akk
250  CALL saxpy( k-1, ct, b( 1, k ), 1, a( 1, k ), 1 )
251  CALL ssyr2( uplo, k-1, one, a( 1, k ), 1, b( 1, k ), 1,
252  \$ a, lda )
253  CALL saxpy( k-1, ct, b( 1, k ), 1, a( 1, k ), 1 )
254  CALL sscal( 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 strmv( uplo, 'Transpose', 'Non-unit', k-1, b, ldb,
268  \$ a( k, 1 ), lda )
269  ct = half*akk
270  CALL saxpy( k-1, ct, b( k, 1 ), ldb, a( k, 1 ), lda )
271  CALL ssyr2( uplo, k-1, one, a( k, 1 ), lda, b( k, 1 ),
272  \$ ldb, a, lda )
273  CALL saxpy( k-1, ct, b( k, 1 ), ldb, a( k, 1 ), lda )
274  CALL sscal( 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 SSYGS2
282 *
subroutine ssyr2(UPLO, N, ALPHA, X, INCX, Y, INCY, A, LDA)
SSYR2
Definition: ssyr2.f:149
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine strmv(UPLO, TRANS, DIAG, N, A, LDA, X, INCX)
STRMV
Definition: strmv.f:149
subroutine strsv(UPLO, TRANS, DIAG, N, A, LDA, X, INCX)
STRSV
Definition: strsv.f:151
subroutine saxpy(N, SA, SX, INCX, SY, INCY)
SAXPY
Definition: saxpy.f:54
subroutine sscal(N, SA, SX, INCX)
SSCAL
Definition: sscal.f:55
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: