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