      subroutine rhsinit(b, descb)
*
*     rhsinit generates distributed vector b for right hand side
*     assumes b to be block-row distributed
*
*     globally:
*               b(i) = 2*i
*
      integer            descb(*)
      double precision   b(*)

      integer            n, nb, nloc, i, iglob
      integer            ictxt, mycol, myrow, npcol, nprow

*     get matrix and grid infos
      ictxt = descb(2)
      n     = descb(3)
      nb    = descb(4)
      call blacs_gridinfo(ictxt, nprow, npcol, myrow, mycol)
      nloc = numroc(n, nb, mycol, 0, npcol)

*     compute array values
      do i=1, nloc
         iglob = indxl2g(i, nb, mycol, 0, npcol)
         b(i) = 2*iglob
      enddo

      return
      end
