-
Notifications
You must be signed in to change notification settings - Fork 1
/
myAPG.m
41 lines (38 loc) · 1.18 KB
/
myAPG.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
33
34
35
36
37
38
39
40
41
function [X, i, time, hist] = myAPG(nr, nc, Amap, ATmap, b, mu_target, Lf, eta, tol)
tic;
X0 = zeros(nr, nc);
X = X0;
t0 = 1;
t = t0;
tau = Lf;
max_iter = 1000;
mu = mu_target;
for i = 1 : max_iter
Y = X + (t0-1)/t * (X-X0);
G = Y - 1 / tau * ATmap(Amap(Y)-b);
% tau = eta * tau;
% for j = epoch
% while 1
% G = Y - 1 / tau * ATmap(Amap(Y)-b);
% S_tau_G = S_tau(G, tau, mu);
% if f(S_tau_G, b, mu, Amap) <= Q_tau(S_tau_G, Y, b, tau, mu, Amap, ATmap)
% break
% else
% tau = min(Lf, tau / eta);
% end
% end
X0 = X;
X = S_tau(G, tau, mu);
% X = S_tau_truncation(G, tau, mu, 100);
t0 = t;
t = 0.5*(1 + sqrt(1+4*t*t));
S = tau*(Y-X)+ATmap(Amap(X-Y));
hist.obj(i) = f(X, b, mu_target, Amap);
% mu = max(mu_target, 0.7*mu);
if norm(S, 'fro') / (tau*max(1, norm(X, 'fro'))) <= tol
fprintf("\n APGL Early Stopping--iteration: %d\n", i);
break
end
end
time = toc;
end