Prev Next newton_l2_ok.m

l1_newton_l2: Example and Test

Source Code
 
function [ok] = newton_l2_ok()
ok = true;
% ------------------------------------------------------------------------
% You can change these parameters
ell = 4; % number of L1 equations
m   = 3; % number of L2 equations
n   = 2; % number of variables in combined minimization problem
% ------------------------------------------------------------------------
% Define the problem
rand('seed', 123);
A        = rand(ell, n);
a        = rand(ell, 1);
B        = rand(ell, n);
b        = rand(ell, 1);
mu       = rand(1, 1);
up       = rand(ell, 1);
um       = rand(ell, 1);
vp       = rand(ell, 1);
vm       = rand(ell, 1);
w        = rand(ell, 1);
x        = rand(n, 1);
Z_ll     = zeros(ell, ell);
Z_ln     = zeros(ell, n);
Z_nl     = zeros(n, ell);
I_l      = eye(ell);
%
dF  = [ ...
     diag(vp) , Z_ll     , diag(up), Z_ll    , Z_ll, Z_ln 
     Z_ll     , diag(vm) , Z_ll    , diag(um), Z_ll, Z_ln
     -I_l     , Z_ll     , Z_ll    , Z_ll    , -I_l, Z_ln
     Z_ll     , -I_l     , Z_ll    , Z_ll    , +I_l, Z_ln
     Z_ll     , Z_ll     , -I_l    , +I_l    , Z_ll, A
     Z_nl     , Z_nl     , Z_nl    , Z_nl    , A'  , B'*B
];
F   = [ ...
     up .* vp - mu
     um .* vm - mu
     +1 - up - w
     +1 - um + w
     A * x - vp + vm - a
     A' * w + B' * B * x - B' * b ...
];
[dup, dum, dvp, dvm, dw, dx] = ...
     l1_newton_l2(A, a, B, 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_l2_ok.m