1 SUBROUTINE pspbtrs( UPLO, N, BW, NRHS, A, JA, DESCA, B, IB, DESCB,
2 $ AF, LAF, WORK, LWORK, INFO )
11 INTEGER BW, IB, INFO, JA, LAF, LWORK, N, NRHS
14 INTEGER DESCA( * ), DESCB( * )
15 REAL A( * ), AF( * ), B( * ), WORK( * )
363 parameter( int_one = 1 )
364 INTEGER DESCMULT, BIGNUM
365 parameter( descmult = 100, bignum = descmult*descmult )
366 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
367 $ lld_, mb_, m_, nb_, n_, rsrc_
368 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
369 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
370 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
373 INTEGER CSRC, FIRST_PROC, ICTXT, ICTXT_NEW, ICTXT_SAVE,
374 $ idum1, idum3, ja_new, llda, lldb, mycol, myrow,
375 $ nb, np, npcol, nprow, np_save, part_offset,
376 $ return_code, store_m_b, store_n_a,
380 INTEGER DESCA_1XP( 7 ), DESCB_PX1( 7 ),
381 $ param_check( 16, 3 )
408 IF( return_code.NE.0 )
THEN
414 IF( return_code.NE.0 )
THEN
421 IF( desca_1xp( 2 ).NE.descb_px1( 2 ) )
THEN
429 IF( desca_1xp( 4 ).NE.descb_px1( 4 ) )
THEN
435 IF( desca_1xp( 5 ).NE.descb_px1( 5 ) )
THEN
441 ictxt = desca_1xp( 2 )
442 csrc = desca_1xp( 5 )
444 llda = desca_1xp( 6 )
445 store_n_a = desca_1xp( 3 )
446 lldb = descb_px1( 6 )
447 store_m_b = descb_px1( 3 )
452 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
457 IF( lsame( uplo,
'U' ) )
THEN
459 ELSE IF( lsame( uplo,
'L' ) )
THEN
465 IF( lwork.LT.-1 )
THEN
467 ELSE IF( lwork.EQ.-1 )
THEN
477 IF( n+ja-1.GT.store_n_a )
THEN
481 IF( ( bw.GT.n-1 ) .OR. ( bw.LT.0 ) )
THEN
485 IF( llda.LT.( bw+1 ) )
THEN
493 IF( n+ib-1.GT.store_m_b )
THEN
497 IF( lldb.LT.nb )
THEN
513 IF( nprow.NE.1 )
THEN
517 IF( n.GT.np*nb-mod( ja-1, nb ) )
THEN
519 CALL pxerbla( ictxt,
'PSPBTRS, D&C alg.: only 1 block per proc'
524 IF( ( ja+n-1.GT.nb ) .AND. ( nb.LT.2*bw ) )
THEN
526 CALL pxerbla( ictxt,
'PSPBTRS, D&C alg.: NB too small', -info )
531 work_size_min = ( bw*nrhs )
533 work( 1 ) = work_size_min
535 IF( lwork.LT.work_size_min )
THEN
536 IF( lwork.NE.-1 )
THEN
538 CALL pxerbla( ictxt,
'PSPBTRS: worksize error', -info )
545 param_check( 16, 1 ) = descb( 5 )
546 param_check( 15, 1 ) = descb( 4 )
547 param_check( 14, 1 ) = descb( 3 )
548 param_check( 13, 1 ) = descb( 2 )
549 param_check( 12, 1 ) = descb( 1 )
550 param_check( 11, 1 ) = ib
551 param_check( 10, 1 ) = desca( 5 )
552 param_check( 9, 1 ) = desca( 4 )
553 param_check( 8, 1 ) = desca( 3 )
554 param_check( 7, 1 ) = desca( 1 )
555 param_check( 6, 1 ) = ja
556 param_check( 5, 1 ) = nrhs
557 param_check( 4, 1 ) = bw
558 param_check( 3, 1 ) = n
559 param_check( 2, 1 ) = idum3
560 param_check( 1, 1 ) = idum1
562 param_check( 16, 2 ) = 1005
563 param_check( 15, 2 ) = 1004
564 param_check( 14, 2 ) = 1003
565 param_check( 13, 2 ) = 1002
566 param_check( 12, 2 ) = 1001
567 param_check( 11, 2 ) = 9
568 param_check( 10, 2 ) = 705
569 param_check( 9, 2 ) = 704
570 param_check( 8, 2 ) = 703
571 param_check( 7, 2 ) = 701
572 param_check( 6, 2 ) = 6
573 param_check( 5, 2 ) = 4
574 param_check( 4, 2 ) = 3
575 param_check( 3, 2 ) = 2
576 param_check( 2, 2 ) = 14
577 param_check( 1, 2 ) = 1
585 ELSE IF( info.LT.-descmult )
THEN
588 info = -info*descmult
593 CALL globchk( ictxt, 16, param_check, 16, param_check( 1, 3 ),
599 IF( info.EQ.bignum )
THEN
601 ELSE IF( mod( info, descmult ).EQ.0 )
THEN
602 info = -info / descmult
608 CALL pxerbla( ictxt,
'PSPBTRS', -info )
624 part_offset = nb*( ( ja-1 ) / ( npcol*nb ) )
626 IF( ( mycol-csrc ).LT.( ja-part_offset-1 ) / nb )
THEN
627 part_offset = part_offset + nb
630 IF( mycol.LT.csrc )
THEN
631 part_offset = part_offset - nb
640 first_proc = mod( ( ja-1 ) / nb+csrc, npcol )
644 ja_new = mod( ja-1, nb ) + 1
649 np = ( ja_new+n-2 ) / nb + 1
653 CALL reshape( ictxt, int_one, ictxt_new, int_one, first_proc,
660 desca_1xp( 2 ) = ictxt_new
661 descb_px1( 2 ) = ictxt_new
665 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
669 IF( myrow.LT.0 )
THEN
681 IF( lsame( uplo,
'L' ) )
THEN
683 CALL pspbtrsv(
'L',
'N', n, bw, nrhs, a( part_offset+1 ),
684 $ ja_new, desca_1xp, b, ib, descb_px1, af, laf,
685 $ work, lwork, info )
689 CALL pspbtrsv(
'U',
'T', n, bw, nrhs, a( part_offset+1 ),
690 $ ja_new, desca_1xp, b, ib, descb_px1, af, laf,
691 $ work, lwork, info )
697 IF( lsame( uplo,
'L' ) )
THEN
699 CALL pspbtrsv(
'L',
'T', n, bw, nrhs, a( part_offset+1 ),
700 $ ja_new, desca_1xp, b, ib, descb_px1, af, laf,
701 $ work, lwork, info )
705 CALL pspbtrsv(
'U',
'N', n, bw, nrhs, a( part_offset+1 ),
706 $ ja_new, desca_1xp, b, ib, descb_px1, af, laf,
707 $ work, lwork, info )
715 IF( ictxt_save.NE.ictxt_new )
THEN
716 CALL blacs_gridexit( ictxt_new )
728 work( 1 ) = work_size_min