125
126
127
128
129
130
131 CHARACTER UPLO
132 INTEGER INFO, ITYPE, LDA, LDB, N
133
134
135 REAL A( LDA, * ), B( LDB, * )
136
137
138
139
140
141 REAL ONE, HALF
142 parameter( one = 1.0, half = 0.5 )
143
144
145 LOGICAL UPPER
146 INTEGER K, KB, NB
147
148
151
152
153 INTRINSIC max, min
154
155
156 LOGICAL LSAME
157 INTEGER ILAENV
159
160
161
162
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
183
184 IF( n.EQ.0 )
185 $ RETURN
186
187
188
189 nb =
ilaenv( 1,
'SSYGST', uplo, n, -1, -1, -1 )
190
191 IF( nb.LE.1 .OR. nb.GE.n ) THEN
192
193
194
195 CALL ssygs2( itype, uplo, n, a, lda, b, ldb, info )
196 ELSE
197
198
199
200 IF( itype.EQ.1 ) THEN
201 IF( upper ) THEN
202
203
204
205 DO 10 k = 1, n, nb
206 kb = min( n-k+1, nb )
207
208
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
236
237 DO 20 k = 1, n, nb
238 kb = min( n-k+1, nb )
239
240
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
269
270 DO 30 k = 1, n, nb
271 kb = min( n-k+1, nb )
272
273
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
296
297 DO 40 k = 1, n, nb
298 kb = min( n-k+1, nb )
299
300
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
324
subroutine xerbla(srname, info)
subroutine ssygs2(itype, uplo, n, a, lda, b, ldb, info)
SSYGS2 reduces a symmetric definite generalized eigenproblem to standard form, using the factorizatio...
subroutine ssymm(side, uplo, m, n, alpha, a, lda, b, ldb, beta, c, ldc)
SSYMM
subroutine ssyr2k(uplo, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
SSYR2K
integer function ilaenv(ispec, name, opts, n1, n2, n3, n4)
ILAENV
logical function lsame(ca, cb)
LSAME
subroutine strmm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
STRMM
subroutine strsm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
STRSM