1 SUBROUTINE pcpbtrs( UPLO, N, BW, NRHS, A, JA, DESCA, B, IB, DESCB,
2 $ AF, LAF, WORK, LWORK, INFO )
13 INTEGER BW, IB, INFO, JA, LAF, LWORK, N, NRHS
16 INTEGER DESCA( * ), DESCB( * )
17 COMPLEX A( * ), AF( * ), B( * ), WORK( * )
367 parameter( one = 1.0e+0 )
368 parameter( zero = 0.0e+0 )
370 parameter( cone = ( 1.0e+0, 0.0e+0 ) )
371 parameter( czero = ( 0.0e+0, 0.0e+0 ) )
373 parameter( int_one = 1 )
374 INTEGER DESCMULT, BIGNUM
375 parameter(descmult = 100, bignum = descmult * descmult)
376 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
377 $ lld_, mb_, m_, nb_, n_, rsrc_
378 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
379 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
380 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
383 INTEGER CSRC, FIRST_PROC, ICTXT, ICTXT_NEW, ICTXT_SAVE,
384 $ idum1, idum3, ja_new, llda, lldb, mycol, myrow,
385 $ nb, np, npcol, nprow, np_save, part_offset,
386 $ return_code, store_m_b, store_n_a,
390 INTEGER DESCA_1XP( 7 ), DESCB_PX1( 7 ),
391 $ param_check( 16, 3 )
400 EXTERNAL lsame, numroc
403 INTRINSIC ichar,
min, mod
419 IF( return_code .NE. 0)
THEN
420 info = -( 7*100 + 2 )
425 IF( return_code .NE. 0)
THEN
426 info = -( 10*100 + 2 )
432 IF( desca_1xp( 2 ) .NE. descb_px1( 2 ) )
THEN
433 info = -( 10*100 + 2 )
440 IF( desca_1xp( 4 ) .NE. descb_px1( 4 ) )
THEN
441 info = -( 10*100 + 4 )
446 IF( desca_1xp( 5 ) .NE. descb_px1( 5 ) )
THEN
447 info = -( 10*100 + 5 )
452 ictxt = desca_1xp( 2 )
453 csrc = desca_1xp( 5 )
455 llda = desca_1xp( 6 )
456 store_n_a = desca_1xp( 3 )
457 lldb = descb_px1( 6 )
458 store_m_b = descb_px1( 3 )
463 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
468 IF( lsame( uplo,
'U' ) )
THEN
470 ELSE IF ( lsame( uplo,
'L' ) )
THEN
476 IF( lwork .LT. -1)
THEN
478 ELSE IF ( lwork .EQ. -1 )
THEN
488 IF( n+ja-1 .GT. store_n_a )
THEN
489 info = -( 7*100 + 6 )
492 IF(( bw .GT. n-1 ) .OR.
493 $ ( bw .LT. 0 ) )
THEN
497 IF( llda .LT. (bw+1) )
THEN
498 info = -( 7*100 + 6 )
502 info = -( 7*100 + 4 )
505 IF( n+ib-1 .GT. store_m_b )
THEN
506 info = -( 10*100 + 3 )
509 IF( lldb .LT. nb )
THEN
510 info = -( 10*100 + 6 )
513 IF( nrhs .LT. 0 )
THEN
525 IF( nprow .NE. 1 )
THEN
529 IF( n .GT. np*nb-mod( ja-1, nb ))
THEN
532 $
'PCPBTRS, D&C alg.: only 1 block per proc',
537 IF((ja+n-1.GT.nb) .AND. ( nb.LT.2*bw ))
THEN
540 $
'PCPBTRS, D&C alg.: NB too small',
549 work( 1 ) = work_size_min
551 IF( lwork .LT. work_size_min )
THEN
552 IF( lwork .NE. -1 )
THEN
555 $
'PCPBTRS: worksize error',
563 param_check( 16, 1 ) = descb(5)
564 param_check( 15, 1 ) = descb(4)
565 param_check( 14, 1 ) = descb(3)
566 param_check( 13, 1 ) = descb(2)
567 param_check( 12, 1 ) = descb(1)
568 param_check( 11, 1 ) = ib
569 param_check( 10, 1 ) = desca(5)
570 param_check( 9, 1 ) = desca(4)
571 param_check( 8, 1 ) = desca(3)
572 param_check( 7, 1 ) = desca(1)
573 param_check( 6, 1 ) = ja
574 param_check( 5, 1 ) = nrhs
575 param_check( 4, 1 ) = bw
576 param_check( 3, 1 ) = n
577 param_check( 2, 1 ) = idum3
578 param_check( 1, 1 ) = idum1
580 param_check( 16, 2 ) = 1005
581 param_check( 15, 2 ) = 1004
582 param_check( 14, 2 ) = 1003
583 param_check( 13, 2 ) = 1002
584 param_check( 12, 2 ) = 1001
585 param_check( 11, 2 ) = 9
586 param_check( 10, 2 ) = 705
587 param_check( 9, 2 ) = 704
588 param_check( 8, 2 ) = 703
589 param_check( 7, 2 ) = 701
590 param_check( 6, 2 ) = 6
591 param_check( 5, 2 ) = 4
592 param_check( 4, 2 ) = 3
593 param_check( 3, 2 ) = 2
594 param_check( 2, 2 ) = 14
595 param_check( 1, 2 ) = 1
603 ELSE IF( info.LT.-descmult )
THEN
606 info = -info * descmult
611 CALL globchk( ictxt, 16, param_check, 16,
612 $ param_check( 1, 3 ), info )
617 IF( info.EQ.bignum )
THEN
619 ELSE IF( mod( info, descmult ) .EQ. 0 )
THEN
620 info = -info / descmult
626 CALL pxerbla( ictxt,
'PCPBTRS', -info )
642 part_offset = nb*( (ja-1)/(npcol*nb) )
644 IF ( (mycol-csrc) .LT. (ja-part_offset-1)/nb )
THEN
645 part_offset = part_offset + nb
648 IF ( mycol .LT. csrc )
THEN
649 part_offset = part_offset - nb
658 first_proc = mod( ( ja-1 )/nb+csrc, npcol )
662 ja_new = mod( ja-1, nb ) + 1
667 np = ( ja_new+n-2 )/nb + 1
671 CALL reshape( ictxt, int_one, ictxt_new, int_one,
672 $ first_proc, int_one, np )
678 desca_1xp( 2 ) = ictxt_new
679 descb_px1( 2 ) = ictxt_new
683 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
687 IF( myrow .LT. 0 )
THEN
699 IF( lsame( uplo,
'L' ) )
THEN
701 CALL pcpbtrsv(
'L',
'N', n, bw, nrhs, a( part_offset+1 ),
702 $ ja_new, desca_1xp, b, ib, descb_px1, af, laf,
703 $ work, lwork, info )
707 CALL pcpbtrsv(
'U',
'C', n, bw, nrhs, a( part_offset+1 ),
708 $ ja_new, desca_1xp, b, ib, descb_px1, af, laf,
709 $ work, lwork, info )
715 IF( lsame( uplo,
'L' ) )
THEN
717 CALL pcpbtrsv(
'L',
'C', n, bw, nrhs, a( part_offset+1 ),
718 $ ja_new, desca_1xp, b, ib, descb_px1, af, laf,
719 $ work, lwork, info )
723 CALL pcpbtrsv(
'U',
'N', n, bw, nrhs, a( part_offset+1 ),
724 $ ja_new, desca_1xp, b, ib, descb_px1, af, laf,
725 $ work, lwork, info )
733 IF( ictxt_save .NE. ictxt_new )
THEN
734 CALL blacs_gridexit( ictxt_new )
746 work( 1 ) = work_size_min