function c=mdiff(a,b)
% mdiff <Exterior matrix difference>
% Usage:: c=mdiff(a,b[a])
%
% mdiff Forms matrix c(n,m)=a(n)-b(m).

% revision history:
% 03/28/03 Mark D. Shattuck <mds> mdiff.m
% 12/13/14 mds convert to bsxfun for speed

%% Main

if(nargin==1)
  c=bsxfun(@minus,a,a');
else
  c=bsxfun(@minus,a,b');
end




