      subroutine printlast(b, descb)
*
*     printlast prints the last 20 entries of the solution vector b
*     or less, if the blocksize is small
*
*     assumes b to be block-row distributed
*
      integer            descb(*)
      double precision   b(*)

      integer            def_n_out
      parameter          (def_n_out = 20)

      integer            n, nb, nloc, n_out, 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)

*     only the last processor works
      if (mycol .ne. (npcol-1)) return

*     print less than 20 values, if blocksize small
      n_out = def_n_out
      if (nloc .lt. def_n_out) then
         n_out = nloc
      endif

*     result should be similar to iglob/3.0, except for last values.
*     therefore print difference

*     print last result values
      do i=nloc-n_out+1, nloc
         iglob = indxl2g(i, nb, mycol, 0, npcol)
         print '(F12.3)', b(i) - iglob/3.0
      enddo

      return
      end
