LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
ssygst.f
Go to the documentation of this file.
1*> \brief \b SSYGST
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download SSYGST + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ssygst.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ssygst.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ssygst.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE SSYGST( ITYPE, UPLO, N, A, LDA, B, LDB, INFO )
20*
21* .. Scalar Arguments ..
22* CHARACTER UPLO
23* INTEGER INFO, ITYPE, LDA, LDB, N
24* ..
25* .. Array Arguments ..
26* REAL A( LDA, * ), B( LDB, * )
27* ..
28*
29*
30*> \par Purpose:
31* =============
32*>
33*> \verbatim
34*>
35*> SSYGST reduces a real symmetric-definite generalized eigenproblem
36*> to standard form.
37*>
38*> If ITYPE = 1, the problem is A*x = lambda*B*x,
39*> and A is overwritten by inv(U**T)*A*inv(U) or inv(L)*A*inv(L**T)
40*>
41*> If ITYPE = 2 or 3, the problem is A*B*x = lambda*x or
42*> B*A*x = lambda*x, and A is overwritten by U*A*U**T or L**T*A*L.
43*>
44*> B must have been previously factorized as U**T*U or L*L**T by SPOTRF.
45*> \endverbatim
46*
47* Arguments:
48* ==========
49*
50*> \param[in] ITYPE
51*> \verbatim
52*> ITYPE is INTEGER
53*> = 1: compute inv(U**T)*A*inv(U) or inv(L)*A*inv(L**T);
54*> = 2 or 3: compute U*A*U**T or L**T*A*L.
55*> \endverbatim
56*>
57*> \param[in] UPLO
58*> \verbatim
59*> UPLO is CHARACTER*1
60*> = 'U': Upper triangle of A is stored and B is factored as
61*> U**T*U;
62*> = 'L': Lower triangle of A is stored and B is factored as
63*> L*L**T.
64*> \endverbatim
65*>
66*> \param[in] N
67*> \verbatim
68*> N is INTEGER
69*> The order of the matrices A and B. N >= 0.
70*> \endverbatim
71*>
72*> \param[in,out] A
73*> \verbatim
74*> A is REAL array, dimension (LDA,N)
75*> On entry, the symmetric matrix A. If UPLO = 'U', the leading
76*> N-by-N upper triangular part of A contains the upper
77*> triangular part of the matrix A, and the strictly lower
78*> triangular part of A is not referenced. If UPLO = 'L', the
79*> leading N-by-N lower triangular part of A contains the lower
80*> triangular part of the matrix A, and the strictly upper
81*> triangular part of A is not referenced.
82*>
83*> On exit, if INFO = 0, the transformed matrix, stored in the
84*> same format as A.
85*> \endverbatim
86*>
87*> \param[in] LDA
88*> \verbatim
89*> LDA is INTEGER
90*> The leading dimension of the array A. LDA >= max(1,N).
91*> \endverbatim
92*>
93*> \param[in] B
94*> \verbatim
95*> B is REAL array, dimension (LDB,N)
96*> The triangular factor from the Cholesky factorization of B,
97*> as returned by SPOTRF.
98*> \endverbatim
99*>
100*> \param[in] LDB
101*> \verbatim
102*> LDB is INTEGER
103*> The leading dimension of the array B. LDB >= max(1,N).
104*> \endverbatim
105*>
106*> \param[out] INFO
107*> \verbatim
108*> INFO is INTEGER
109*> = 0: successful exit
110*> < 0: if INFO = -i, the i-th argument had an illegal value
111*> \endverbatim
112*
113* Authors:
114* ========
115*
116*> \author Univ. of Tennessee
117*> \author Univ. of California Berkeley
118*> \author Univ. of Colorado Denver
119*> \author NAG Ltd.
120*
121*> \ingroup hegst
122*
123* =====================================================================
124 SUBROUTINE ssygst( ITYPE, UPLO, N, A, LDA, B, LDB, INFO )
125*
126* -- LAPACK computational routine --
127* -- LAPACK is a software package provided by Univ. of Tennessee, --
128* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
129*
130* .. Scalar Arguments ..
131 CHARACTER UPLO
132 INTEGER INFO, ITYPE, LDA, LDB, N
133* ..
134* .. Array Arguments ..
135 REAL A( LDA, * ), B( LDB, * )
136* ..
137*
138* =====================================================================
139*
140* .. Parameters ..
141 REAL ONE, HALF
142 parameter( one = 1.0, half = 0.5 )
143* ..
144* .. Local Scalars ..
145 LOGICAL UPPER
146 INTEGER K, KB, NB
147* ..
148* .. External Subroutines ..
149 EXTERNAL ssygs2, ssymm, ssyr2k, strmm, strsm,
150 $ xerbla
151* ..
152* .. Intrinsic Functions ..
153 INTRINSIC max, min
154* ..
155* .. External Functions ..
156 LOGICAL LSAME
157 INTEGER ILAENV
158 EXTERNAL lsame, ilaenv
159* ..
160* .. Executable Statements ..
161*
162* Test the input parameters.
163*
164 info = 0
165 upper = lsame( uplo, 'U' )
166 IF( itype.LT.1 .OR. itype.GT.3 ) THEN
167 info = -1
168 ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
169 info = -2
170 ELSE IF( n.LT.0 ) THEN
171 info = -3
172 ELSE IF( lda.LT.max( 1, n ) ) THEN
173 info = -5
174 ELSE IF( ldb.LT.max( 1, n ) ) THEN
175 info = -7
176 END IF
177 IF( info.NE.0 ) THEN
178 CALL xerbla( 'SSYGST', -info )
179 RETURN
180 END IF
181*
182* Quick return if possible
183*
184 IF( n.EQ.0 )
185 $ RETURN
186*
187* Determine the block size for this environment.
188*
189 nb = ilaenv( 1, 'SSYGST', uplo, n, -1, -1, -1 )
190*
191 IF( nb.LE.1 .OR. nb.GE.n ) THEN
192*
193* Use unblocked code
194*
195 CALL ssygs2( itype, uplo, n, a, lda, b, ldb, info )
196 ELSE
197*
198* Use blocked code
199*
200 IF( itype.EQ.1 ) THEN
201 IF( upper ) THEN
202*
203* Compute inv(U**T)*A*inv(U)
204*
205 DO 10 k = 1, n, nb
206 kb = min( n-k+1, nb )
207*
208* Update the upper triangle of A(k:n,k:n)
209*
210 CALL ssygs2( itype, uplo, kb, a( k, k ), lda,
211 $ b( k, k ), ldb, info )
212 IF( k+kb.LE.n ) THEN
213 CALL strsm( 'Left', uplo, 'Transpose',
214 $ 'Non-unit',
215 $ kb, n-k-kb+1, one, b( k, k ), ldb,
216 $ a( k, k+kb ), lda )
217 CALL ssymm( 'Left', uplo, kb, n-k-kb+1, -half,
218 $ a( k, k ), lda, b( k, k+kb ), ldb, one,
219 $ a( k, k+kb ), lda )
220 CALL ssyr2k( uplo, 'Transpose', n-k-kb+1, kb,
221 $ -one,
222 $ a( k, k+kb ), lda, b( k, k+kb ), ldb,
223 $ one, a( k+kb, k+kb ), lda )
224 CALL ssymm( 'Left', uplo, kb, n-k-kb+1, -half,
225 $ a( k, k ), lda, b( k, k+kb ), ldb, one,
226 $ a( k, k+kb ), lda )
227 CALL strsm( 'Right', uplo, 'No transpose',
228 $ 'Non-unit', kb, n-k-kb+1, one,
229 $ b( k+kb, k+kb ), ldb, a( k, k+kb ),
230 $ lda )
231 END IF
232 10 CONTINUE
233 ELSE
234*
235* Compute inv(L)*A*inv(L**T)
236*
237 DO 20 k = 1, n, nb
238 kb = min( n-k+1, nb )
239*
240* Update the lower triangle of A(k:n,k:n)
241*
242 CALL ssygs2( itype, uplo, kb, a( k, k ), lda,
243 $ b( k, k ), ldb, info )
244 IF( k+kb.LE.n ) THEN
245 CALL strsm( 'Right', uplo, 'Transpose',
246 $ 'Non-unit',
247 $ n-k-kb+1, kb, one, b( k, k ), ldb,
248 $ a( k+kb, k ), lda )
249 CALL ssymm( 'Right', uplo, n-k-kb+1, kb, -half,
250 $ a( k, k ), lda, b( k+kb, k ), ldb, one,
251 $ a( k+kb, k ), lda )
252 CALL ssyr2k( uplo, 'No transpose', n-k-kb+1, kb,
253 $ -one, a( k+kb, k ), lda, b( k+kb, k ),
254 $ ldb, one, a( k+kb, k+kb ), lda )
255 CALL ssymm( 'Right', uplo, n-k-kb+1, kb, -half,
256 $ a( k, k ), lda, b( k+kb, k ), ldb, one,
257 $ a( k+kb, k ), lda )
258 CALL strsm( 'Left', uplo, 'No transpose',
259 $ 'Non-unit', n-k-kb+1, kb, one,
260 $ b( k+kb, k+kb ), ldb, a( k+kb, k ),
261 $ lda )
262 END IF
263 20 CONTINUE
264 END IF
265 ELSE
266 IF( upper ) THEN
267*
268* Compute U*A*U**T
269*
270 DO 30 k = 1, n, nb
271 kb = min( n-k+1, nb )
272*
273* Update the upper triangle of A(1:k+kb-1,1:k+kb-1)
274*
275 CALL strmm( 'Left', uplo, 'No transpose',
276 $ 'Non-unit',
277 $ k-1, kb, one, b, ldb, a( 1, k ), lda )
278 CALL ssymm( 'Right', uplo, k-1, kb, half, a( k,
279 $ k ),
280 $ lda, b( 1, k ), ldb, one, a( 1, k ), lda )
281 CALL ssyr2k( uplo, 'No transpose', k-1, kb, one,
282 $ a( 1, k ), lda, b( 1, k ), ldb, one, a,
283 $ lda )
284 CALL ssymm( 'Right', uplo, k-1, kb, half, a( k,
285 $ k ),
286 $ lda, b( 1, k ), ldb, one, a( 1, k ), lda )
287 CALL strmm( 'Right', uplo, 'Transpose', 'Non-unit',
288 $ k-1, kb, one, b( k, k ), ldb, a( 1, k ),
289 $ lda )
290 CALL ssygs2( itype, uplo, kb, a( k, k ), lda,
291 $ b( k, k ), ldb, info )
292 30 CONTINUE
293 ELSE
294*
295* Compute L**T*A*L
296*
297 DO 40 k = 1, n, nb
298 kb = min( n-k+1, nb )
299*
300* Update the lower triangle of A(1:k+kb-1,1:k+kb-1)
301*
302 CALL strmm( 'Right', uplo, 'No transpose',
303 $ 'Non-unit',
304 $ kb, k-1, one, b, ldb, a( k, 1 ), lda )
305 CALL ssymm( 'Left', uplo, kb, k-1, half, a( k, k ),
306 $ lda, b( k, 1 ), ldb, one, a( k, 1 ), lda )
307 CALL ssyr2k( uplo, 'Transpose', k-1, kb, one,
308 $ a( k, 1 ), lda, b( k, 1 ), ldb, one, a,
309 $ lda )
310 CALL ssymm( 'Left', uplo, kb, k-1, half, a( k, k ),
311 $ lda, b( k, 1 ), ldb, one, a( k, 1 ), lda )
312 CALL strmm( 'Left', uplo, 'Transpose', 'Non-unit',
313 $ kb,
314 $ k-1, one, b( k, k ), ldb, a( k, 1 ), lda )
315 CALL ssygs2( itype, uplo, kb, a( k, k ), lda,
316 $ b( k, k ), ldb, info )
317 40 CONTINUE
318 END IF
319 END IF
320 END IF
321 RETURN
322*
323* End of SSYGST
324*
325 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine ssygs2(itype, uplo, n, a, lda, b, ldb, info)
SSYGS2 reduces a symmetric definite generalized eigenproblem to standard form, using the factorizatio...
Definition ssygs2.f:125
subroutine ssygst(itype, uplo, n, a, lda, b, ldb, info)
SSYGST
Definition ssygst.f:125
subroutine ssymm(side, uplo, m, n, alpha, a, lda, b, ldb, beta, c, ldc)
SSYMM
Definition ssymm.f:189
subroutine ssyr2k(uplo, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
SSYR2K
Definition ssyr2k.f:192
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