      subroutine descinit_row( desc, n, nb, irsrc, ictxt, lld, info )
*
*     adaptation of scalapack routine descinit to block row distribution
*
*     .. Scalar Arguments ..
      integer            n, nb, irsrc, ictxt, lld, info
*     ..
*     .. Array Arguments ..
      integer            desc(*)
*     ..
*
*  Purpose
*  =======
*
*  DESCINIT initializes the descriptor vector with the 5 input arguments
*  N, NB, IRSRC, ICTXT, LLD.
*
*  cf. ScaLAPACK User's Guide, ch. 4.4
*
*  Arguments
*  =========
*
*  DESC    (output) INTEGER array of dimension DLEN_.
*          The array descriptor of a distributed matrix to be set.
*
*  N       (global input) INTEGER
*          The number of rows in the distributed matrix. N >= 0.
*
*  NB      (global input) INTEGER
*          The blocking factor used to distribute the rows of the
*          matrix. NB >= 1.
*
*  IRSRC   (global input) INTEGER
*          The process row over which the first row of the matrix is
*          distributed. 0 <= IRSRC < NPROW.
*
*  ICTXT   (global input) INTEGER
*          The BLACS context handle, indicating the global context of
*          the operation on the matrix. The context itself is global.
*
*  LLD     (local input)  INTEGER
*          The leading dimension of the local array storing the local
*          blocks of the distributed matrix. LLD >= MAX(1,LOCr(M)).
*
*  INFO    (output) INTEGER
*          = 0: successful exit
*          < 0: if INFO = -i, the i-th argument had an illegal value
*
*  =====================================================================
*
*     .. Parameters ..
      INTEGER            BLOCK_ROW_1D, CTXT_, DLEN_, DTYPE_,
     $                   LLD_, NB_, N_, RSRC_
      PARAMETER          ( BLOCK_ROW_1D = 502, DLEN_ = 7, DTYPE_ = 1,
     $                     CTXT_ = 2, N_ = 3, NB_ = 4,
     $                     RSRC_ = 5, LLD_ = 6 )
*     ..
*     .. Local Scalars ..
      INTEGER            MYCOL, MYROW, NPCOL, NPROW
*     ..
*     .. External Subroutines ..
      EXTERNAL           BLACS_GRIDINFO, PXERBLA
*     ..
*     .. Intrinsic Functions ..
      INTRINSIC          MAX, MIN
*     ..
*     .. Executable Statements ..
*
*     Get grid parameters
*
      CALL BLACS_GRIDINFO( ICTXT, NPROW, NPCOL, MYROW, MYCOL )
*
      INFO = 0
      IF( N.LT.0 ) THEN
         INFO = -2
      ELSE IF( NB.LT.1 ) THEN
         INFO = -3
      ELSE IF( IRSRC.LT.0 .OR. IRSRC.GE.NPROW ) THEN
         INFO = -4
      ELSE IF( NPROW.EQ.-1 ) THEN
         INFO = -5
      ELSE IF( LLD.LT. 1 ) THEN
         INFO = -6
      END IF
*
      IF( INFO.NE.0 )
     $   CALL PXERBLA( ICTXT, 'DESCINIT_ROW', -INFO )
*
      DESC( DTYPE_ ) = BLOCK_ROW_1D
      DESC( N_ )  = MAX( 0, N )
      DESC( NB_ ) = MAX( 1, NB )
      DESC( RSRC_ ) = MAX( 0, MIN( IRSRC, NPROW-1 ) )
      DESC( CTXT_ ) = ICTXT
      DESC( LLD_ )  = MAX( LLD, 1 )
*
      RETURN
      END
