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

◆ ssygs2()

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).

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

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.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 126 of file ssygs2.f.

127*
128* -- LAPACK computational routine --
129* -- LAPACK is a software package provided by Univ. of Tennessee, --
130* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
131*
132* .. Scalar Arguments ..
133 CHARACTER UPLO
134 INTEGER INFO, ITYPE, LDA, LDB, N
135* ..
136* .. Array Arguments ..
137 REAL A( LDA, * ), B( LDB, * )
138* ..
139*
140* =====================================================================
141*
142* .. Parameters ..
143 REAL ONE, HALF
144 parameter( one = 1.0, half = 0.5 )
145* ..
146* .. Local Scalars ..
147 LOGICAL UPPER
148 INTEGER K
149 REAL AKK, BKK, CT
150* ..
151* .. External Subroutines ..
152 EXTERNAL saxpy, sscal, ssyr2, strmv, strsv, xerbla
153* ..
154* .. Intrinsic Functions ..
155 INTRINSIC max
156* ..
157* .. External Functions ..
158 LOGICAL LSAME
159 EXTERNAL lsame
160* ..
161* .. Executable Statements ..
162*
163* Test the input parameters.
164*
165 info = 0
166 upper = lsame( uplo, 'U' )
167 IF( itype.LT.1 .OR. itype.GT.3 ) THEN
168 info = -1
169 ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
170 info = -2
171 ELSE IF( n.LT.0 ) THEN
172 info = -3
173 ELSE IF( lda.LT.max( 1, n ) ) THEN
174 info = -5
175 ELSE IF( ldb.LT.max( 1, n ) ) THEN
176 info = -7
177 END IF
178 IF( info.NE.0 ) THEN
179 CALL xerbla( 'SSYGS2', -info )
180 RETURN
181 END IF
182*
183 IF( itype.EQ.1 ) THEN
184 IF( upper ) THEN
185*
186* Compute inv(U**T)*A*inv(U)
187*
188 DO 10 k = 1, n
189*
190* Update the upper triangle of A(k:n,k:n)
191*
192 akk = a( k, k )
193 bkk = b( k, k )
194 akk = akk / bkk**2
195 a( k, k ) = akk
196 IF( k.LT.n ) THEN
197 CALL sscal( n-k, one / bkk, a( k, k+1 ), lda )
198 ct = -half*akk
199 CALL saxpy( n-k, ct, b( k, k+1 ), ldb, a( k, k+1 ),
200 $ lda )
201 CALL ssyr2( uplo, n-k, -one, a( k, k+1 ), lda,
202 $ b( k, k+1 ), ldb, a( k+1, k+1 ), lda )
203 CALL saxpy( n-k, ct, b( k, k+1 ), ldb, a( k, k+1 ),
204 $ lda )
205 CALL strsv( uplo, 'Transpose', 'Non-unit', n-k,
206 $ b( k+1, k+1 ), ldb, a( k, k+1 ), lda )
207 END IF
208 10 CONTINUE
209 ELSE
210*
211* Compute inv(L)*A*inv(L**T)
212*
213 DO 20 k = 1, n
214*
215* Update the lower triangle of A(k:n,k:n)
216*
217 akk = a( k, k )
218 bkk = b( k, k )
219 akk = akk / bkk**2
220 a( k, k ) = akk
221 IF( k.LT.n ) THEN
222 CALL sscal( n-k, one / bkk, a( k+1, k ), 1 )
223 ct = -half*akk
224 CALL saxpy( n-k, ct, b( k+1, k ), 1, a( k+1, k ), 1 )
225 CALL ssyr2( uplo, n-k, -one, a( k+1, k ), 1,
226 $ b( k+1, k ), 1, a( k+1, k+1 ), lda )
227 CALL saxpy( n-k, ct, b( k+1, k ), 1, a( k+1, k ), 1 )
228 CALL strsv( uplo, 'No transpose', 'Non-unit', n-k,
229 $ b( k+1, k+1 ), ldb, a( k+1, k ), 1 )
230 END IF
231 20 CONTINUE
232 END IF
233 ELSE
234 IF( upper ) THEN
235*
236* Compute U*A*U**T
237*
238 DO 30 k = 1, n
239*
240* Update the upper triangle of A(1:k,1:k)
241*
242 akk = a( k, k )
243 bkk = b( k, k )
244 CALL strmv( uplo, 'No transpose', 'Non-unit', k-1, b,
245 $ ldb, a( 1, k ), 1 )
246 ct = half*akk
247 CALL saxpy( k-1, ct, b( 1, k ), 1, a( 1, k ), 1 )
248 CALL ssyr2( uplo, k-1, one, a( 1, k ), 1, b( 1, k ), 1,
249 $ a, lda )
250 CALL saxpy( k-1, ct, b( 1, k ), 1, a( 1, k ), 1 )
251 CALL sscal( k-1, bkk, a( 1, k ), 1 )
252 a( k, k ) = akk*bkk**2
253 30 CONTINUE
254 ELSE
255*
256* Compute L**T *A*L
257*
258 DO 40 k = 1, n
259*
260* Update the lower triangle of A(1:k,1:k)
261*
262 akk = a( k, k )
263 bkk = b( k, k )
264 CALL strmv( uplo, 'Transpose', 'Non-unit', k-1, b, ldb,
265 $ a( k, 1 ), lda )
266 ct = half*akk
267 CALL saxpy( k-1, ct, b( k, 1 ), ldb, a( k, 1 ), lda )
268 CALL ssyr2( uplo, k-1, one, a( k, 1 ), lda, b( k, 1 ),
269 $ ldb, a, lda )
270 CALL saxpy( k-1, ct, b( k, 1 ), ldb, a( k, 1 ), lda )
271 CALL sscal( k-1, bkk, a( k, 1 ), lda )
272 a( k, k ) = akk*bkk**2
273 40 CONTINUE
274 END IF
275 END IF
276 RETURN
277*
278* End of SSYGS2
279*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine saxpy(n, sa, sx, incx, sy, incy)
SAXPY
Definition saxpy.f:89
subroutine ssyr2(uplo, n, alpha, x, incx, y, incy, a, lda)
SSYR2
Definition ssyr2.f:147
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine sscal(n, sa, sx, incx)
SSCAL
Definition sscal.f:79
subroutine strmv(uplo, trans, diag, n, a, lda, x, incx)
STRMV
Definition strmv.f:147
subroutine strsv(uplo, trans, diag, n, a, lda, x, incx)
STRSV
Definition strsv.f:149
Here is the call graph for this function:
Here is the caller graph for this function: