function varargout = fitclinear(X,Y,varargin)
%FITCLINEAR Fit a linear classification model to high-dimensional data.
%   MDL = FITCLINEAR(TBL,RESPONSEVARNAME)
%   MDL = FITCLINEAR(TBL,FORMULA)
%   MDL = FITCLINEAR(TBL,Y)
%   MDL = FITCLINEAR(X,Y)
%   MDL = FITCLINEAR(___,'PARAM1',val1,'PARAM2',val2,...)
%
%   Limitations:
%   1) Predictor data must not be sparse.
%   2) The 'Solver' name-value argument must be "bfgs", "lbfgs", "sparsa",
%      or a cell array containing these values.
%
%   Usage notes:
%   The default solver for gpuArray inputs is:
%    - "bfgs" when you specify a ridge penalty and less than 101 predictor
%      variables.
%    - "lbfgs" when you specify a ridge penalty and more than 100 predictor
%      variables.
%    - "sparsa" when you specify a lasso penalty.
%
%   See also gpuArray, fitclinear, ClassificationLinear.

%   Copyright 2023 The MathWorks, Inc.

% Validate the inputs.
narginchk(2,inf);
argsToEnsureOnDeviceIfPossible = "beta";
[X,Y,varargin{:}] = validateInputsForClassificationFitFunction(X,Y,varargin,argsToEnsureOnDeviceIfPossible);

[varargout{1:nargout}] = parallel.internal.array.callToolboxFunction("stats/classreg/fitclinear", X, Y, varargin{:});
end