function y = iprectrf(x,y,ipeval)
% Data transformation by recursive interpolation.
% The function handle ipeval is an evaluation routine
% for an interpolation scheme.

n = length(x); 
if (n ~= length(y)), error('length mismatch'); end
if (n > 2)
  % Odd number of data points needed for binary decimation
  if (mod(n,2) ~= 1), error('odd number of points required'); end
  y(2:2:n-1) = y(2:2:n-1) - ipeval(x(1:2:n),y(1:2:n),x(2:2:n-1));
  y(1:2:n) = iprectrf(x(1:2:n),y(1:2:n),ipeval);
end