1 SUBROUTINE pzdbtrs( TRANS, N, BWL, BWU, NRHS, A, JA, DESCA, B, IB,
2 $ DESCB, AF, LAF, WORK, LWORK, INFO )
13 INTEGER BWL, BWU, IB, INFO, JA, LAF, LWORK, N, NRHS
16 INTEGER DESCA( * ), DESCB( * )
17 COMPLEX*16 A( * ), AF( * ), B( * ), WORK( * )
370 DOUBLE PRECISION ONE, ZERO
371 parameter( one = 1.0d+0 )
372 parameter( zero = 0.0d+0 )
373 COMPLEX*16 CONE, CZERO
374 parameter( cone = ( 1.0d+0, 0.0d+0 ) )
375 parameter( czero = ( 0.0d+0, 0.0d+0 ) )
377 parameter( int_one = 1 )
378 INTEGER DESCMULT, BIGNUM
379 parameter(descmult = 100, bignum = descmult * descmult)
380 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
381 $ lld_, mb_, m_, nb_, n_, rsrc_
382 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
383 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
384 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
387 INTEGER CSRC, FIRST_PROC, ICTXT, ICTXT_NEW, ICTXT_SAVE,
388 $ idum2, idum3, ja_new, llda, lldb, mycol, myrow,
389 $ nb, np, npcol, nprow, np_save, part_offset,
390 $ return_code, store_m_b, store_n_a,
394 INTEGER DESCA_1XP( 7 ), DESCB_PX1( 7 ),
395 $ param_check( 17, 3 )
404 EXTERNAL lsame, numroc
407 INTRINSIC ichar,
min, mod
423 IF( return_code .NE. 0)
THEN
424 info = -( 8*100 + 2 )
429 IF( return_code .NE. 0)
THEN
430 info = -( 11*100 + 2 )
436 IF( desca_1xp( 2 ) .NE. descb_px1( 2 ) )
THEN
437 info = -( 11*100 + 2 )
444 IF( desca_1xp( 4 ) .NE. descb_px1( 4 ) )
THEN
445 info = -( 11*100 + 4 )
450 IF( desca_1xp( 5 ) .NE. descb_px1( 5 ) )
THEN
451 info = -( 11*100 + 5 )
456 ictxt = desca_1xp( 2 )
457 csrc = desca_1xp( 5 )
459 llda = desca_1xp( 6 )
460 store_n_a = desca_1xp( 3 )
461 lldb = descb_px1( 6 )
462 store_m_b = descb_px1( 3 )
467 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
472 IF( lsame( trans,
'N' ) )
THEN
474 ELSE IF ( lsame( trans,
'C' ) )
THEN
480 IF( lwork .LT. -1)
THEN
482 ELSE IF ( lwork .EQ. -1 )
THEN
492 IF( n+ja-1 .GT. store_n_a )
THEN
493 info = -( 8*100 + 6 )
496 IF(( bwl .GT. n-1 ) .OR.
497 $ ( bwl .LT. 0 ) )
THEN
501 IF(( bwu .GT. n-1 ) .OR.
502 $ ( bwu .LT. 0 ) )
THEN
506 IF( llda .LT. (bwl+bwu+1) )
THEN
507 info = -( 8*100 + 6 )
511 info = -( 8*100 + 4 )
514 IF( n+ib-1 .GT. store_m_b )
THEN
515 info = -( 11*100 + 3 )
518 IF( lldb .LT. nb )
THEN
519 info = -( 11*100 + 6 )
522 IF( nrhs .LT. 0 )
THEN
534 IF( nprow .NE. 1 )
THEN
538 IF( n .GT. np*nb-mod( ja-1, nb ))
THEN
541 $
'PZDBTRS, D&C alg.: only 1 block per proc',
546 IF((ja+n-1.GT.nb) .AND. ( nb.LT.2*
max(bwl,bwu) ))
THEN
549 $
'PZDBTRS, D&C alg.: NB too small',
556 $ (
max(bwl,bwu)*nrhs)
558 work( 1 ) = work_size_min
560 IF( lwork .LT. work_size_min )
THEN
561 IF( lwork .NE. -1 )
THEN
564 $
'PZDBTRS: worksize error',
572 param_check( 17, 1 ) = descb(5)
573 param_check( 16, 1 ) = descb(4)
574 param_check( 15, 1 ) = descb(3)
575 param_check( 14, 1 ) = descb(2)
576 param_check( 13, 1 ) = descb(1)
577 param_check( 12, 1 ) = ib
578 param_check( 11, 1 ) = desca(5)
579 param_check( 10, 1 ) = desca(4)
580 param_check( 9, 1 ) = desca(3)
581 param_check( 8, 1 ) = desca(1)
582 param_check( 7, 1 ) = ja
583 param_check( 6, 1 ) = nrhs
584 param_check( 5, 1 ) = bwu
585 param_check( 4, 1 ) = bwl
586 param_check( 3, 1 ) = n
587 param_check( 2, 1 ) = idum3
588 param_check( 1, 1 ) = idum2
590 param_check( 17, 2 ) = 1105
591 param_check( 16, 2 ) = 1104
592 param_check( 15, 2 ) = 1103
593 param_check( 14, 2 ) = 1102
594 param_check( 13, 2 ) = 1101
595 param_check( 12, 2 ) = 10
596 param_check( 11, 2 ) = 805
597 param_check( 10, 2 ) = 804
598 param_check( 9, 2 ) = 803
599 param_check( 8, 2 ) = 801
600 param_check( 7, 2 ) = 7
601 param_check( 6, 2 ) = 5
602 param_check( 5, 2 ) = 4
603 param_check( 4, 2 ) = 3
604 param_check( 3, 2 ) = 2
605 param_check( 2, 2 ) = 15
606 param_check( 1, 2 ) = 1
614 ELSE IF( info.LT.-descmult )
THEN
617 info = -info * descmult
622 CALL globchk( ictxt, 17, param_check, 17,
623 $ param_check( 1, 3 ), info )
628 IF( info.EQ.bignum )
THEN
630 ELSE IF( mod( info, descmult ) .EQ. 0 )
THEN
631 info = -info / descmult
637 CALL pxerbla( ictxt,
'PZDBTRS', -info )
653 part_offset = nb*( (ja-1)/(npcol*nb) )
655 IF ( (mycol-csrc) .LT. (ja-part_offset-1)/nb )
THEN
656 part_offset = part_offset + nb
659 IF ( mycol .LT. csrc )
THEN
660 part_offset = part_offset - nb
669 first_proc = mod( ( ja-1 )/nb+csrc, npcol )
673 ja_new = mod( ja-1, nb ) + 1
678 np = ( ja_new+n-2 )/nb + 1
682 CALL reshape( ictxt, int_one, ictxt_new, int_one,
683 $ first_proc, int_one, np )
689 desca_1xp( 2 ) = ictxt_new
690 descb_px1( 2 ) = ictxt_new
694 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
698 IF( myrow .LT. 0 )
THEN
710 IF( lsame( trans,
'N' ) )
THEN
712 CALL pzdbtrsv(
'L',
'N', n, bwl, bwu, nrhs, a( part_offset+1 ),
713 $ ja_new, desca_1xp, b, ib, descb_px1, af, laf,
714 $ work, lwork, info )
718 CALL pzdbtrsv(
'U',
'C', n, bwl, bwu, nrhs, a( part_offset+1 ),
719 $ ja_new, desca_1xp, b, ib, descb_px1, af, laf,
720 $ work, lwork, info )
726 IF( lsame( trans,
'C' ) )
THEN
728 CALL pzdbtrsv(
'L',
'C', n, bwl, bwu, nrhs, a( part_offset+1 ),
729 $ ja_new, desca_1xp, b, ib, descb_px1, af, laf,
730 $ work, lwork, info )
734 CALL pzdbtrsv(
'U',
'N', n, bwl, bwu, nrhs, a( part_offset+1 ),
735 $ ja_new, desca_1xp, b, ib, descb_px1, af, laf,
736 $ work, lwork, info )
744 IF( ictxt_save .NE. ictxt_new )
THEN
745 CALL blacs_gridexit( ictxt_new )
757 work( 1 ) = work_size_min