function M = vc2blkM(vc, r, rM)
%vc2blkM  Reshaping a matrix vc of rc by 1 vectors into a block-matrix 
%         M  of  rM  by  cM  size
%
% Each rc-element column of vc is converted into a  r by c block
% of a matrix  M  and placed as a block-row element 

[rc nb] = size(vc) ; pxls = rc*nb ;

if ( (rem(pxls, rM) ~= 0) | (rem(rM, r) ~= 0) )
   error('incorrect number of rows of the matrix')
end
cM = pxls/rM ;

if ( (rem(rc, r) ~= 0) | (rem(nb*r, rM) ~= 0) )
  error('incorrect block size')
end
c = rc/r ;

xM = zeros(r, nb*c);
xM(:) = vc ;

nrb = rM/r ; 
M = zeros(rM, cM);

for ii = 0:nrb-1
   M((1:r)+ii*r, :) = xM(:, (1:cM)+ii*cM) ;
end


