      subroutine pack(m,n,a,lda,mb,b,ldb)
      real a(lda,*), b(ldb,*)
      integer m, n, lda, mb, ldb
      jb = 1
      do 20 j=1,m
	    ib = 1
	    do 10 i=1,n
	       b(ib,jb) = a(i,j)
	       ib = ib + 1
	       if (ib .eq. mb) then
		  ib = 1
		  jb = jb + 1
               endif
   10       continue
   20 continue
      return
      end
