140
141
142
143
144
145
146 CHARACTER UPLO
147 INTEGER INFO, KD, LDAB, N
148
149
150 COMPLEX AB( LDAB, * )
151
152
153
154
155
156 REAL ONE, ZERO
157 parameter( one = 1.0e+0, zero = 0.0e+0 )
158 COMPLEX CONE
159 parameter( cone = ( 1.0e+0, 0.0e+0 ) )
160 INTEGER NBMAX, LDWORK
161 parameter( nbmax = 32, ldwork = nbmax+1 )
162
163
164 INTEGER I, I2, I3, IB, II, J, JJ, NB
165
166
167 COMPLEX WORK( LDWORK, NBMAX )
168
169
170 LOGICAL LSAME
171 INTEGER ILAENV
173
174
177
178
179 INTRINSIC min
180
181
182
183
184
185 info = 0
186 IF( ( .NOT.
lsame( uplo,
'U' ) ) .AND.
187 $ ( .NOT.
lsame( uplo,
'L' ) ) )
THEN
188 info = -1
189 ELSE IF( n.LT.0 ) THEN
190 info = -2
191 ELSE IF( kd.LT.0 ) THEN
192 info = -3
193 ELSE IF( ldab.LT.kd+1 ) THEN
194 info = -5
195 END IF
196 IF( info.NE.0 ) THEN
197 CALL xerbla(
'CPBTRF', -info )
198 RETURN
199 END IF
200
201
202
203 IF( n.EQ.0 )
204 $ RETURN
205
206
207
208 nb =
ilaenv( 1,
'CPBTRF', uplo, n, kd, -1, -1 )
209
210
211
212
213 nb = min( nb, nbmax )
214
215 IF( nb.LE.1 .OR. nb.GT.kd ) THEN
216
217
218
219 CALL cpbtf2( uplo, n, kd, ab, ldab, info )
220 ELSE
221
222
223
224 IF(
lsame( uplo,
'U' ) )
THEN
225
226
227
228
229
230
231
232 DO 20 j = 1, nb
233 DO 10 i = 1, j - 1
234 work( i, j ) = zero
235 10 CONTINUE
236 20 CONTINUE
237
238
239
240 DO 70 i = 1, n, nb
241 ib = min( nb, n-i+1 )
242
243
244
245 CALL cpotf2( uplo, ib, ab( kd+1, i ), ldab-1, ii )
246 IF( ii.NE.0 ) THEN
247 info = i + ii - 1
248 GO TO 150
249 END IF
250 IF( i+ib.LE.n ) THEN
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266 i2 = min( kd-ib, n-i-ib+1 )
267 i3 = min( ib, n-i-kd+1 )
268
269 IF( i2.GT.0 ) THEN
270
271
272
273 CALL ctrsm(
'Left',
'Upper',
274 $ 'Conjugate transpose',
275 $ 'Non-unit', ib, i2, cone,
276 $ ab( kd+1, i ), ldab-1,
277 $ ab( kd+1-ib, i+ib ), ldab-1 )
278
279
280
281 CALL cherk(
'Upper',
'Conjugate transpose', i2,
282 $ ib,
283 $ -one, ab( kd+1-ib, i+ib ), ldab-1, one,
284 $ ab( kd+1, i+ib ), ldab-1 )
285 END IF
286
287 IF( i3.GT.0 ) THEN
288
289
290
291 DO 40 jj = 1, i3
292 DO 30 ii = jj, ib
293 work( ii, jj ) = ab( ii-jj+1, jj+i+kd-1 )
294 30 CONTINUE
295 40 CONTINUE
296
297
298
299 CALL ctrsm(
'Left',
'Upper',
300 $ 'Conjugate transpose',
301 $ 'Non-unit', ib, i3, cone,
302 $ ab( kd+1, i ), ldab-1, work, ldwork )
303
304
305
306 IF( i2.GT.0 )
307 $
CALL cgemm(
'Conjugate transpose',
308 $ 'No transpose', i2, i3, ib, -cone,
309 $ ab( kd+1-ib, i+ib ), ldab-1, work,
310 $ ldwork, cone, ab( 1+ib, i+kd ),
311 $ ldab-1 )
312
313
314
315 CALL cherk(
'Upper',
'Conjugate transpose', i3,
316 $ ib,
317 $ -one, work, ldwork, one,
318 $ ab( kd+1, i+kd ), ldab-1 )
319
320
321
322 DO 60 jj = 1, i3
323 DO 50 ii = jj, ib
324 ab( ii-jj+1, jj+i+kd-1 ) = work( ii, jj )
325 50 CONTINUE
326 60 CONTINUE
327 END IF
328 END IF
329 70 CONTINUE
330 ELSE
331
332
333
334
335
336
337
338 DO 90 j = 1, nb
339 DO 80 i = j + 1, nb
340 work( i, j ) = zero
341 80 CONTINUE
342 90 CONTINUE
343
344
345
346 DO 140 i = 1, n, nb
347 ib = min( nb, n-i+1 )
348
349
350
351 CALL cpotf2( uplo, ib, ab( 1, i ), ldab-1, ii )
352 IF( ii.NE.0 ) THEN
353 info = i + ii - 1
354 GO TO 150
355 END IF
356 IF( i+ib.LE.n ) THEN
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372 i2 = min( kd-ib, n-i-ib+1 )
373 i3 = min( ib, n-i-kd+1 )
374
375 IF( i2.GT.0 ) THEN
376
377
378
379 CALL ctrsm(
'Right',
'Lower',
380 $ 'Conjugate transpose', 'Non-unit', i2,
381 $ ib, cone, ab( 1, i ), ldab-1,
382 $ ab( 1+ib, i ), ldab-1 )
383
384
385
386 CALL cherk(
'Lower',
'No transpose', i2, ib,
387 $ -one,
388 $ ab( 1+ib, i ), ldab-1, one,
389 $ ab( 1, i+ib ), ldab-1 )
390 END IF
391
392 IF( i3.GT.0 ) THEN
393
394
395
396 DO 110 jj = 1, ib
397 DO 100 ii = 1, min( jj, i3 )
398 work( ii, jj ) = ab( kd+1-jj+ii, jj+i-1 )
399 100 CONTINUE
400 110 CONTINUE
401
402
403
404 CALL ctrsm(
'Right',
'Lower',
405 $ 'Conjugate transpose', 'Non-unit', i3,
406 $ ib, cone, ab( 1, i ), ldab-1, work,
407 $ ldwork )
408
409
410
411 IF( i2.GT.0 )
412 $
CALL cgemm(
'No transpose',
413 $ 'Conjugate transpose', i3, i2, ib,
414 $ -cone, work, ldwork, ab( 1+ib, i ),
415 $ ldab-1, cone, ab( 1+kd-ib, i+ib ),
416 $ ldab-1 )
417
418
419
420 CALL cherk(
'Lower',
'No transpose', i3, ib,
421 $ -one,
422 $ work, ldwork, one, ab( 1, i+kd ),
423 $ ldab-1 )
424
425
426
427 DO 130 jj = 1, ib
428 DO 120 ii = 1, min( jj, i3 )
429 ab( kd+1-jj+ii, jj+i-1 ) = work( ii, jj )
430 120 CONTINUE
431 130 CONTINUE
432 END IF
433 END IF
434 140 CONTINUE
435 END IF
436 END IF
437 RETURN
438
439 150 CONTINUE
440 RETURN
441
442
443
subroutine xerbla(srname, info)
subroutine cgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
CGEMM
subroutine cherk(uplo, trans, n, k, alpha, a, lda, beta, c, ldc)
CHERK
integer function ilaenv(ispec, name, opts, n1, n2, n3, n4)
ILAENV
logical function lsame(ca, cb)
LSAME
subroutine cpbtf2(uplo, n, kd, ab, ldab, info)
CPBTF2 computes the Cholesky factorization of a symmetric/Hermitian positive definite band matrix (un...
subroutine cpotf2(uplo, n, a, lda, info)
CPOTF2 computes the Cholesky factorization of a symmetric/Hermitian positive definite matrix (unblock...
subroutine ctrsm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
CTRSM