Source Code  function [ok] = newton_quad_ok() ok = true; % ------------------------------------------------------------------------ % You can change these parameters n = 2; % number of variables in l1 minimization problem % ------------------------------------------------------------------------ % Define the problem rand('seed', 123); A = rand(n, n); A = A' * A; b = rand(n, 1); lambda = rand(1, 1); epsilon = rand(1, 1); u = rand(n, 1); v = rand(n, 1); y = rand(n, 1); z = rand(n, 1); % % compute solution [du, dv, dy, dz] = l1_newton_quad(A, b, lambda, epsilon, u, v, y, z); % % check solution one_n = ones(n, 1); z_n = zeros(n, 1); I_n = eye(n); Z_n = zeros(n, n); F = [ ... u .* y v .* z A * (u - v) + b - y + lambda -A * (u - v) - b - z + lambda ... ]; dF = [ ... diag(y) , Z_n , diag(u), Z_n Z_n , diag(z) , Z_n , diag(v) A , -A , -I_n , Z_n -A , A , Z_n , -I_n ... ]; rhs = epsilon * [ one_n ; one_n; z_n; z_n ] - F; delta = [du; dv; dy; dz]; ok = ok & max( abs( dF * delta - rhs ) ) <= 1e-10; return end