1 SUBROUTINE pcdttrs( TRANS, N, NRHS, DL, D, DU, JA, DESCA, B, IB,
2 $ DESCB, AF, LAF, WORK, LWORK, INFO )
13 INTEGER IB, INFO, JA, LAF, LWORK, N, NRHS
16 INTEGER DESCA( * ), DESCB( * )
17 COMPLEX AF( * ), B( * ), D( * ), DL( * ), DU( * ),
385 parameter( one = 1.0e+0 )
386 parameter( zero = 0.0e+0 )
388 parameter( cone = ( 1.0e+0, 0.0e+0 ) )
389 parameter( czero = ( 0.0e+0, 0.0e+0 ) )
391 parameter( int_one = 1 )
392 INTEGER DESCMULT, BIGNUM
393 parameter(descmult = 100, bignum = descmult * descmult)
394 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
395 $ lld_, mb_, m_, nb_, n_, rsrc_
396 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
397 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
398 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
401 INTEGER CSRC, FIRST_PROC, ICTXT, ICTXT_NEW, ICTXT_SAVE,
402 $ idum2, idum3, ja_new, llda, lldb, mycol, myrow,
403 $ my_num_cols, nb, np, npcol, nprow, np_save,
404 $ odd_size, part_offset, part_size,
405 $ return_code, store_m_b, store_n_a, temp,
409 INTEGER DESCA_1XP( 7 ), DESCB_PX1( 7 ),
410 $ param_check( 15, 3 )
420 EXTERNAL cdotc, lsame, numroc
423 INTRINSIC ichar,
min, mod
437 temp = desca( dtype_ )
438 IF( temp .EQ. 502 )
THEN
440 desca( dtype_ ) = 501
445 desca( dtype_ ) = temp
447 IF( return_code .NE. 0)
THEN
448 info = -( 8*100 + 2 )
453 IF( return_code .NE. 0)
THEN
454 info = -( 11*100 + 2 )
460 IF( desca_1xp( 2 ) .NE. descb_px1( 2 ) )
THEN
461 info = -( 11*100 + 2 )
468 IF( desca_1xp( 4 ) .NE. descb_px1( 4 ) )
THEN
469 info = -( 11*100 + 4 )
474 IF( desca_1xp( 5 ) .NE. descb_px1( 5 ) )
THEN
475 info = -( 11*100 + 5 )
480 ictxt = desca_1xp( 2 )
481 csrc = desca_1xp( 5 )
483 llda = desca_1xp( 6 )
484 store_n_a = desca_1xp( 3 )
485 lldb = descb_px1( 6 )
486 store_m_b = descb_px1( 3 )
491 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
496 IF( lsame( trans,
'N' ) )
THEN
498 ELSE IF ( lsame( trans,
'C' ) )
THEN
504 IF( lwork .LT. -1)
THEN
506 ELSE IF ( lwork .EQ. -1 )
THEN
516 IF( n+ja-1 .GT. store_n_a )
THEN
517 info = -( 8*100 + 6 )
520 IF( n+ib-1 .GT. store_m_b )
THEN
521 info = -( 11*100 + 3 )
524 IF( lldb .LT. nb )
THEN
525 info = -( 11*100 + 6 )
528 IF( nrhs .LT. 0 )
THEN
540 IF( nprow .NE. 1 )
THEN
544 IF( n .GT. np*nb-mod( ja-1, nb ))
THEN
547 $
'PCDTTRS, D&C alg.: only 1 block per proc',
552 IF((ja+n-1.GT.nb) .AND. ( nb.LT.2*int_one ))
THEN
555 $
'PCDTTRS, D&C alg.: NB too small',
564 work( 1 ) = work_size_min
566 IF( lwork .LT. work_size_min )
THEN
567 IF( lwork .NE. -1 )
THEN
570 $
'PCDTTRS: worksize error',
578 param_check( 15, 1 ) = descb(5)
579 param_check( 14, 1 ) = descb(4)
580 param_check( 13, 1 ) = descb(3)
581 param_check( 12, 1 ) = descb(2)
582 param_check( 11, 1 ) = descb(1)
583 param_check( 10, 1 ) = ib
584 param_check( 9, 1 ) = desca(5)
585 param_check( 8, 1 ) = desca(4)
586 param_check( 7, 1 ) = desca(3)
587 param_check( 6, 1 ) = desca(1)
588 param_check( 5, 1 ) = ja
589 param_check( 4, 1 ) = nrhs
590 param_check( 3, 1 ) = n
591 param_check( 2, 1 ) = idum3
592 param_check( 1, 1 ) = idum2
594 param_check( 15, 2 ) = 1105
595 param_check( 14, 2 ) = 1104
596 param_check( 13, 2 ) = 1103
597 param_check( 12, 2 ) = 1102
598 param_check( 11, 2 ) = 1101
599 param_check( 10, 2 ) = 10
600 param_check( 9, 2 ) = 805
601 param_check( 8, 2 ) = 804
602 param_check( 7, 2 ) = 803
603 param_check( 6, 2 ) = 801
604 param_check( 5, 2 ) = 7
605 param_check( 4, 2 ) = 3
606 param_check( 3, 2 ) = 2
607 param_check( 2, 2 ) = 15
608 param_check( 1, 2 ) = 1
616 ELSE IF( info.LT.-descmult )
THEN
619 info = -info * descmult
624 CALL globchk( ictxt, 15, param_check, 15,
625 $ param_check( 1, 3 ), info )
630 IF( info.EQ.bignum )
THEN
632 ELSE IF( mod( info, descmult ) .EQ. 0 )
THEN
633 info = -info / descmult
639 CALL pxerbla( ictxt,
'PCDTTRS', -info )
655 part_offset = nb*( (ja-1)/(npcol*nb) )
657 IF ( (mycol-csrc) .LT. (ja-part_offset-1)/nb )
THEN
658 part_offset = part_offset + nb
661 IF ( mycol .LT. csrc )
THEN
662 part_offset = part_offset - nb
671 first_proc = mod( ( ja-1 )/nb+csrc, npcol )
675 ja_new = mod( ja-1, nb ) + 1
680 np = ( ja_new+n-2 )/nb + 1
684 CALL reshape( ictxt, int_one, ictxt_new, int_one,
685 $ first_proc, int_one, np )
691 desca_1xp( 2 ) = ictxt_new
692 descb_px1( 2 ) = ictxt_new
696 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
700 IF( myrow .LT. 0 )
THEN
713 my_num_cols = numroc( n, part_size, mycol, 0, npcol )
717 IF ( mycol .EQ. 0 )
THEN
718 part_offset = part_offset+mod( ja_new-1, part_size )
719 my_num_cols = my_num_cols - mod(ja_new-1, part_size )
724 odd_size = my_num_cols
725 IF ( mycol .LT. np-1 )
THEN
726 odd_size = odd_size - int_one
737 IF( lsame( trans,
'N' ) )
THEN
739 CALL pcdttrsv(
'L',
'N', n, nrhs, dl( part_offset+1 ),
740 $ d( part_offset+1 ), du( part_offset+1 ), ja_new,
741 $ desca_1xp, b, ib, descb_px1, af, laf, work,
746 CALL pcdttrsv(
'U',
'C', n, nrhs, dl( part_offset+1 ),
747 $ d( part_offset+1 ), du( part_offset+1 ), ja_new,
748 $ desca_1xp, b, ib, descb_px1, af, laf, work,
755 IF( lsame( trans,
'C' ) )
THEN
757 CALL pcdttrsv(
'L',
'C', n, nrhs, dl( part_offset+1 ),
758 $ d( part_offset+1 ), du( part_offset+1 ), ja_new,
759 $ desca_1xp, b, ib, descb_px1, af, laf, work,
764 CALL pcdttrsv(
'U',
'N', n, nrhs, dl( part_offset+1 ),
765 $ d( part_offset+1 ), du( part_offset+1 ), ja_new,
766 $ desca_1xp, b, ib, descb_px1, af, laf, work,
775 IF( ictxt_save .NE. ictxt_new )
THEN
776 CALL blacs_gridexit( ictxt_new )
788 work( 1 ) = work_size_min