You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: solver_RPCA_SPGL1.m
    path of file: ./repos/lrslibrary/algorithms/rpca/SPGL1
    
    the code of the file until where you have to start completion: function [L,S,errHist] = solver_RPCA_SPGL1(AY,lambda_S, epsilon, A_cell, opts)
% [L,S,errHist] = solver_RPCA_SPGL1(Y,lambda_S, epsilon, A_cell, opts)
% Solves the problem
%   minimize_{L,S} f(L,S)
%   subject to 
%       || A( L+S ) - Y ||_F <= epsilon
%   if opts.sum = true
%       (1) f(L,S) = ||L||_* + lambda_S ||S||_1 
%   if opts.max = true
%       (2) f(L,S) = max( ||L||_* , lambda_S ||S||_1 ) 

    
function [L,S,errHist] = solver_RPCA_SPGL1(AY,lambda_S, epsilon, A_cell, opts)
% [L,S,errHist] = solver_RPCA_SPGL1(Y,lambda_S, epsilon, A_cell, opts)
% Solves the problem
%   minimize_{L,S} f(L,S)
%   subject to 
%       || A( L+S ) - Y ||_F <= epsilon
%   if opts.sum = true
%       (1) f(L,S) = ||L||_* + lambda_S ||S||_1 
%   if opts.max = true
%       (2) f(L,S) = max( ||L||_* , lambda_S ||S||_1 ) 
%
%   By default, A is the identity, 
%   or if A_cell is provided, where A_cell = {A, At}
%   (A is a function handle, At is a function handle to the transpose of A)
%
%   This uses the trick from SPGL1 to call several subproblems
%
%   errHist(1,:) is a record of the residual
%   errHist(2,:) is a record of the full objective (that is, .5*resid^2 )
%   errHist(3,:) is the output of opts.errFcn if provided
%
% opts is a structure with options:
%   opts.tau0       starting point for SPGL1 search (default: 10)
%   opts.SPGL1_tol  tolerance for 1D Newton search (default: 1e-2)
%   opts.SPGL1_maxIts   maximum number of iterations for 1D search (default: 10)
%
% And these options are the same as in solver_RPCA_constrained.m
%   opts.sum, opts.max  (as described above)
%   opts.L0         initial guess for L (default is 0)
%   opts.S0         initial guess for S (default is 0)
%   opts.tol        sets stopping tolerance (default is 1e-6)
%   opts.maxIts     sets maximum number of iterations
%   opts.printEvery will print information this many iterations
%   opts.displayTime will print out timing information (default is true for large problems)
%   opts.errFcn     a function of (L,S) that records information
%   opts.trueObj    if provided, this will be subtracted from errHist(2,:)
%   opts.Lip        Lipschitz constant, i.e., 2*spectralNorm(A)^2
%                       by default, assume 2 (e.g., good if A = P_Omega)
%   opts.FISTA      whether to use FISTA or not. By default, true
%     opts.restart  how often to restart FISTA; set to -Inf to make it automatic
%   opts.BB         whether to use the Barzilai-Borwein spectral steplength
%     opts.BB_type  which BB stepsize to take. Default is 1, the larger step
%     opts.BB_split whether to calculate stepslengths for S and L independ