function varargout = intersect(varargin)
%INTERSECT Set intersect.
%   C = intersect(A,B)    
%   [C,IA,IB] = intersect(A,B)    
%   [C,IA,IB] = intersect(A,B,'rows')    
%   [C,IA,IB] = intersect(A,B,'stable') 
%   [C,IA,IB] = intersect(A,B,'stable','rows') 
%   [C,IA,IB] = intersect(A,B,'sorted') 
%   [C,IA,IB] = intersect(A,B,'sorted','rows') 
%   
%   The 'legacy' flag is not supported.
%   64-bit integers are not supported.
%    
%   Examples:
%    
%      a = gpuArray([9 9 9 9 9 9 8 8 8 8 7 7 7 6 6 6 5 5 4 2 1])
%      b = gpuArray([1 1 1 3 3 3 3 3 4 4 4 4 4 10 10 10])
%      
%      [c1,ia1,ib1] = intersect(a,b)
%      % returns
%      c1 = [1 4], ia1 = [21 19]', ib1 = [1 9]'
%      
%      [c2,ia2,ib2] = intersect(a,b,'stable')
%      % returns
%      c2 = [4 1], ia2 = [19 21]', ib2 = [9 1]'
%      
%      c = intersect(gpuArray([1 NaN 2 3]),gpuArray([3 4 NaN 1]))
%      % NaNs compare as not equal, so this returns
%      c = [1 3]
%    See also intersect, gpuArray.


%   Copyright 2015 The MathWorks, Inc.

% try...catch prevents error being reported by internal
try
    [varargout{1:nargout}] = parallel.internal.flowthrough.intersect(varargin{:});
catch ME
    throw(ME);
end
