Prev Next linear_ok.m

l1_linear: Example and Test

Source Code
 
function [ok] = linear_ok()
ok = true;
% ------------------------------------------------------------------------
% You can change these parameters
m = 200;  % number of equations in l1 minimization problem
n = 100;  % number of variables in l1 minimization problem
% ------------------------------------------------------------------------
% Define the problem
rand('seed', 123);
A        = rand(m, n) * diag( 1:n );
b        = diag( 1:m ) * rand(m, 1);
%
% compute solution
max_itr    = 20;
delta      = 1e-5 * max(max(abs(A)));
[x , info] = l1_linear(max_itr, A, b, delta);
%
% check solution
obj = sum( abs( A * x - b ) );
for j = 1 : n
     xj    = x(j);
     x(j)  = xj + 1e-2;
     check = sum( abs( A * x - b ) );
     ok    = ok & (check >= obj);
     x(j)  = xj - 1e-2;
     check = sum( abs( A * x - b ) );
     ok    = ok & (check >= obj);
     x(j)  = xj;
end
%
return
end

Input File: test/linear_ok.m