function varargout = fitrlinear(X,Y,varargin)
%FITRLINEAR Fit a linear regression model to high-dimensional data.
%   MDL = FITRLINEAR(TBL,RESPONSEVARNAME)
%   MDL = FITRLINEAR(TBL,FORMULA)
%   MDL = FITRLINEAR(TBL,Y)
%   MDL = FITRLINEAR(X,Y)
%   MDL = FITRLINEAR(___,'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, fitrlinear, RegressionLinear.

%   Copyright 2023 The MathWorks, Inc.

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

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