% zero padding matrix in the pixel domain: matrix vector multiplication
%
% (c) by Hannes Nickisch, MPI for Biological Cybernetics, 2010 December 6

function y = mvm(A,x,ctransp)

  D  = numel(A.imsz); id = cell(1,D);
  for d = 1:D, id{d} = A.padlow(d) + (1:A.imsz(d)); end
  if ctransp
    y = reshape(x,A.imsz+A.padlow+A.padupp);
    y = y(id{:});
  else
    y = zeros(A.imsz+A.padlow+A.padupp);   
    y(id{:}) = reshape(x,A.imsz);
  end