1 SUBROUTINE pzpttrs( UPLO, N, NRHS, D, E, JA, DESCA, B, IB, DESCB,
2 $ AF, LAF, WORK, LWORK, INFO )
13 INTEGER IB, INFO, JA, LAF, LWORK, N, NRHS
16 INTEGER DESCA( * ), DESCB( * )
17 COMPLEX*16 AF( * ), B( * ), E( * ), WORK( * )
18 DOUBLE PRECISION D( * )
377 DOUBLE PRECISION ONE, ZERO
378 parameter( one = 1.0d+0 )
379 parameter( zero = 0.0d+0 )
380 COMPLEX*16 CONE, CZERO
381 parameter( cone = ( 1.0d+0, 0.0d+0 ) )
382 parameter( czero = ( 0.0d+0, 0.0d+0 ) )
384 parameter( int_one = 1 )
385 INTEGER DESCMULT, BIGNUM
386 parameter(descmult = 100, bignum = descmult * descmult)
387 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
388 $ lld_, mb_, m_, nb_, n_, rsrc_
389 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
390 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
391 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
394 INTEGER CSRC, FIRST_PROC, I, ICTXT, ICTXT_NEW,
395 $ ictxt_save, idum1, idum3, ja_new, llda, lldb,
396 $ mycol, myrow, my_num_cols, nb, np, npcol,
397 $ nprow, np_save, odd_size,
398 $ part_offset, part_size, return_code, store_m_b,
399 $ store_n_a, temp, work_size_min
402 INTEGER DESCA_1XP( 7 ), DESCB_PX1( 7 ),
403 $ param_check( 15, 3 )
412 EXTERNAL lsame, numroc
415 INTRINSIC ichar,
min, mod
429 temp = desca( dtype_ )
430 IF( temp .EQ. 502 )
THEN
432 desca( dtype_ ) = 501
437 desca( dtype_ ) = temp
439 IF( return_code .NE. 0)
THEN
440 info = -( 6*100 + 2 )
445 IF( return_code .NE. 0)
THEN
446 info = -( 9*100 + 2 )
452 IF( desca_1xp( 2 ) .NE. descb_px1( 2 ) )
THEN
453 info = -( 9*100 + 2 )
460 IF( desca_1xp( 4 ) .NE. descb_px1( 4 ) )
THEN
461 info = -( 9*100 + 4 )
466 IF( desca_1xp( 5 ) .NE. descb_px1( 5 ) )
THEN
467 info = -( 9*100 + 5 )
472 ictxt = desca_1xp( 2 )
473 csrc = desca_1xp( 5 )
475 llda = desca_1xp( 6 )
476 store_n_a = desca_1xp( 3 )
477 lldb = descb_px1( 6 )
478 store_m_b = descb_px1( 3 )
483 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
488 IF( lsame( uplo,
'U' ) )
THEN
490 ELSE IF ( lsame( uplo,
'L' ) )
THEN
496 IF( lwork .LT. -1)
THEN
498 ELSE IF ( lwork .EQ. -1 )
THEN
508 IF( n+ja-1 .GT. store_n_a )
THEN
509 info = -( 6*100 + 6 )
512 IF( n+ib-1 .GT. store_m_b )
THEN
513 info = -( 9*100 + 3 )
516 IF( lldb .LT. nb )
THEN
517 info = -( 9*100 + 6 )
520 IF( nrhs .LT. 0 )
THEN
532 IF( nprow .NE. 1 )
THEN
536 IF( n .GT. np*nb-mod( ja-1, nb ))
THEN
539 $
'PZPTTRS, D&C alg.: only 1 block per proc',
544 IF((ja+n-1.GT.nb) .AND. ( nb.LT.2*int_one ))
THEN
547 $
'PZPTTRS, D&C alg.: NB too small',
554 $ (10+2*
min(100,nrhs))*npcol+4*nrhs
556 work( 1 ) = work_size_min
558 IF( lwork .LT. work_size_min )
THEN
559 IF( lwork .NE. -1 )
THEN
562 $
'PZPTTRS: worksize error',
570 param_check( 15, 1 ) = descb(5)
571 param_check( 14, 1 ) = descb(4)
572 param_check( 13, 1 ) = descb(3)
573 param_check( 12, 1 ) = descb(2)
574 param_check( 11, 1 ) = descb(1)
575 param_check( 10, 1 ) = ib
576 param_check( 9, 1 ) = desca(5)
577 param_check( 8, 1 ) = desca(4)
578 param_check( 7, 1 ) = desca(3)
579 param_check( 6, 1 ) = desca(1)
580 param_check( 5, 1 ) = ja
581 param_check( 4, 1 ) = nrhs
582 param_check( 3, 1 ) = n
583 param_check( 2, 1 ) = idum3
584 param_check( 1, 1 ) = idum1
586 param_check( 15, 2 ) = 905
587 param_check( 14, 2 ) = 904
588 param_check( 13, 2 ) = 903
589 param_check( 12, 2 ) = 902
590 param_check( 11, 2 ) = 901
591 param_check( 10, 2 ) = 8
592 param_check( 9, 2 ) = 605
593 param_check( 8, 2 ) = 604
594 param_check( 7, 2 ) = 603
595 param_check( 6, 2 ) = 601
596 param_check( 5, 2 ) = 5
597 param_check( 4, 2 ) = 3
598 param_check( 3, 2 ) = 2
599 param_check( 2, 2 ) = 13
600 param_check( 1, 2 ) = 1
608 ELSE IF( info.LT.-descmult )
THEN
611 info = -info * descmult
616 CALL globchk( ictxt, 15, param_check, 15,
617 $ param_check( 1, 3 ), info )
622 IF( info.EQ.bignum )
THEN
624 ELSE IF( mod( info, descmult ) .EQ. 0 )
THEN
625 info = -info / descmult
631 CALL pxerbla( ictxt,
'PZPTTRS', -info )
647 part_offset = nb*( (ja-1)/(npcol*nb) )
649 IF ( (mycol-csrc) .LT. (ja-part_offset-1)/nb )
THEN
650 part_offset = part_offset + nb
653 IF ( mycol .LT. csrc )
THEN
654 part_offset = part_offset - nb
663 first_proc = mod( ( ja-1 )/nb+csrc, npcol )
667 ja_new = mod( ja-1, nb ) + 1
672 np = ( ja_new+n-2 )/nb + 1
676 CALL reshape( ictxt, int_one, ictxt_new, int_one,
677 $ first_proc, int_one, np )
683 desca_1xp( 2 ) = ictxt_new
684 descb_px1( 2 ) = ictxt_new
688 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
692 IF( myrow .LT. 0 )
THEN
705 my_num_cols = numroc( n, part_size, mycol, 0, npcol )
709 IF ( mycol .EQ. 0 )
THEN
710 part_offset = part_offset+mod( ja_new-1, part_size )
711 my_num_cols = my_num_cols - mod(ja_new-1, part_size )
716 odd_size = my_num_cols
717 IF ( mycol .LT. np-1 )
THEN
718 odd_size = odd_size - int_one
729 IF( lsame( uplo,
'L' ) )
THEN
731 CALL pzpttrsv(
'L',
'N', n, nrhs, d( part_offset+1 ),
732 $ e( part_offset+1 ), ja_new, desca_1xp, b, ib,
733 $ descb_px1, af, laf, work, lwork, info )
737 CALL pzpttrsv(
'U',
'C', n, nrhs, d( part_offset+1 ),
738 $ e( part_offset+1 ), ja_new, desca_1xp, b, ib,
739 $ descb_px1, af, laf, work, lwork, info )
747 DO 10 i=part_offset+1, part_offset+odd_size
748 CALL zscal( nrhs, dcmplx( cone/d( i ) ), b( i ), lldb )
753 IF( mycol .LT. npcol-1 )
THEN
754 i=part_offset+odd_size+1
755 CALL zscal( nrhs, cone/af( odd_size+2 ), b( i ), lldb )
760 IF( lsame( uplo,
'L' ) )
THEN
762 CALL pzpttrsv(
'L',
'C', n, nrhs, d( part_offset+1 ),
763 $ e( part_offset+1 ), ja_new, desca_1xp, b, ib,
764 $ descb_px1, af, laf, work, lwork, info )
768 CALL pzpttrsv(
'U',
'N', n, nrhs, d( part_offset+1 ),
769 $ e( part_offset+1 ), ja_new, desca_1xp, b, ib,
770 $ descb_px1, af, laf, work, lwork, info )
778 IF( ictxt_save .NE. ictxt_new )
THEN
779 CALL blacs_gridexit( ictxt_new )
791 work( 1 ) = work_size_min