%
% run the example of subsection 3
%

A = [-1 0 0 0 0 0
0 1 0 0 0 0
0 -1 1 0 0 0
0 0 0 1 0 0
0 -1 0 0 1 0
0 0 0 -1 1 0
0 0 0 0 -1 1];

R = [1 1 1 1 10 1 1];

K = A'*diag(1./R)*A

f1 = [1 0 -1 0 0 0]';

f2 = [1 0 0 0 0 -1]';

x1 = K\f1

x2 = K\f2

B=[x1(4) x2(4);1 1];

a=B\[0 1]'

x=a(1)*x1+a(2)*x2

