function M=intmap(min,max)
% intmap - Discretisation map for integers (ie alread discrete)
%
% intmap :: integer~'min value', integer~'max value' -> dmap(N).
%
% Maps integers to natural numbers, saves on multiplications and
% roundings as performed by the real->natural maps.

	N=max-min+1;
	off=min-1;
	M=dmap(N,@map,@revmap);

	function I=map(X)
		I=X-off;
		I(I<1)=-inf;
		I(I>N)=inf;
	end

	function X=revmap(I)
		I=shiftdim(shiftdim(I),-1);
		X1=off+I-0.5;
		X2=off+I+0.5;
		X=cat(1,X1,X2);
	end
end
	
