function r=mod(a,d)

% r=mod(a,d). If a and d are integers, then r is the integer
% remainder of a after division by d. If a and d are integer
% matrices, then r is the matrix of remainders after division
% by corresponding entries. Compare with MATLAB's rem.

r=a-d.*floor(a./d)


