% shifting matrix
%
% Circular shift with subpixel accuracy of an n-dimensional signal.
% For integer shifts, A' = inv(A).
%
% A = matShift(sz,shift)
%
% (c) by Hannes Nickisch, MPI for Biological Cybernetics, 2011 January 5

function A = matShift(sz, shift, complex)
  
  A.imsz = sz; sz = prod(A.imsz)*[1,1];
  if nargin<2, shift = A.imsz*0; end
  A.shift  = shift;
  if nargin<3, complex = 1; end
  if numel(complex)==1, complex = complex*[1,1]; end
  
  A = class(A,mfilename,mat(sz,complex));