function varargout = svdsketch(varargin)
%SVDS  Matrix sketch in form of an SVD of a codistributed matrix.
%   [U,S,V] = svdsketch(A)
%   [U,S,V] = svdsketch(A, tol)
%   [U,S,V] = svdsketch(A, tol, Name, Value)
%   
%   See also SVDS, EIGS, CODISTRIBUTED, CODISTRIBUTED/SVDS, CODISTRIBUTED/EIGS.


%   Copyright 2021 The MathWorks, Inc.

% Gather trailing arguments.
if nargin >= 2
    varargin(2:end) = distributedutil.CodistParser.gatherElements(varargin(2:end));
    % Call in-memory if A is not codistributed.
    if ~iscodistributed(varargin{1})
        [varargout{1:nargout}] = svdsketch(varargin{:});
        return
    end
end

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