Prev Next newton_line_ok.m

l1_newton_line: Example and Test

Source Code
 
function [ok] = newton_line_ok()
ok = true;
% ------------------------------------------------------------------------
% You can change these parameters
m = 3;  % number of l1 equations
n = 2;  % number of variables in l1 minimization problem
% ------------------------------------------------------------------------
% Define the problem
rand('seed', 123);
A        = rand(m, n);
b        = rand(m, 1);
mu       = rand(1, 1);
up       = rand(m, 1);
um       = rand(m, 1);
vp       = rand(m, 1);
vm       = rand(m, 1);
w        = rand(m, 1);
x        = rand(n, 1);
Z_mm     = zeros(m, m);
Z_mn     = zeros(m, n);
Z_nm     = zeros(n, m);
Z_nn     = zeros(n, n);
I_m      = eye(m);
%
dF  = [ ...
     diag(vp) , Z_mm     , diag(up), Z_mm    , Z_mm, Z_mn 
     Z_mm     , diag(vm) , Z_mm    , diag(um), Z_mm, Z_mn
     -I_m     , Z_mm     , Z_mm    , Z_mm    , -I_m, Z_mn
     Z_mm     , -I_m     , Z_mm    , Z_mm    , +I_m, Z_mn
     Z_mm     , Z_mm     , -I_m    , +I_m    , Z_mm, A
     Z_nm     , Z_nm     , Z_nm    , Z_nm    , A'  , Z_nn
];
F   = [ ...
     up .* vp - mu
     um .* vm - mu
     +1 - up - w
     +1 - um + w
     A * x - vp + vm - b
     A' * w ...
];
[dup, dum, dvp, dvm, dw, dx] = ...
     l1_newton_line(A, b, mu, up, um, vp, vm, w, x);
delta = [dup ; dum ; dvp ; dvm ; dw ; dx];
ok    = ok & max( abs( F + dF * delta ) ) <= 1e-10;
%
return
end

Input File: test/newton_line_ok.m