-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMNM.m
32 lines (29 loc) · 788 Bytes
/
MNM.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function [xk,dk,alk,iWk,betak,Hk,tauk] = MNM(x,f,g,h,epsG,kmax,almax,almin,rho,c1,c2,iW)
tauk = [];
betak = [];
Hk = [];
xk = [x];
alk = [];
iWk = [];
dk = [];
k = 0;
while norm(g(x)) > epsG && k < kmax-1
d = -h(x)^-1 * g(x);
dk = [dk,d];
%find alk
if iW == 0 %ELS
%g(x) = Qx - b
Q = h(x);
al = -(g(x)'*d)/(d'*Q*d); %direccio del metode o d = -g(x) ??
iWk = [iWk, -1];
elseif iW == 1 || iW == 2 %BLS WC or SWC
[al,iWx] = bls(x,d,f,g,almax,almin,rho,c1,c2,iW);
iWk = [iWk, iWx];
alk = [alk,al];
end
x = x+al*d;
xk = [xk,x];
k = k+1;
tauk = [tauk,0];
end
end