% Resampling matrix: derivatives
%
% (c) by Hannes Nickisch & Alexander Loktyushin, 
%                               MPI for Biological Cybernetics, 2011 February 11

function dAi = d(A,i)
  
  if nargin<2                                         % default derivative index
    i = 0;
  else
    i = fix(i);
    if i>A.ndims, error('i is too large.'), end
    if i<0,       error('i is too small.'), end
  end
  A.di = i;                            % which derivative, 0 means no derivative
  dAi = A;                                                       % assign output