 opts.gpu_id = [];
end

if ~isfield(opts,'sample')
    opts.sample = 300;
end

if ~isfield(opts,'tol')
    opts.tol = 1e-7;
end

if ~isfield(opts,'tol_')
    opts.tol_ = 1e-2;
end

if ~isfield(opts,'max_iter')
    opts.max_iter = 2000;
end

%% Compute the first term of the gradient that wonâ€™t change throughout the function
h = A'*Y - opts.lambda;

%% Assert that the dimensions of the input corresponds to an NNLS problem
if nargin<5
    x = zeros(size(A,2),size(Y,2));
    if nargin<4
        G = A'*A;