Commit bb79c5db authored by Stefan Ziehe's avatar Stefan Ziehe
Browse files

Some optimizations for PALM in case detailed error statistics are omitted.

parent c54d8b37
......@@ -51,29 +51,30 @@ class PALM(Algorithm):
ignore_error = self.ignore_error;
iters = 0;
change = zeros(maxiter+1);
change[0] = 999;
current_change = tol+1;
num_custom_errors = len(self.custom_error.customerror(u,u))
custom_errors = zeros((num_custom_errors,maxiter+1));
custom_errors[:,0] = 999;
if ignore_error = False:
change = zeros(maxiter+1);
num_custom_errors = len(self.custom_error.customerror(u,u))
custom_errors = zeros((num_custom_errors,maxiter+1));
tmp_u = u;
while iters < maxiter and change[iters] > tol:
while iters < maxiter and current_change > tol:
iters += 1;
for p in projs:
tmp_u = p.work(tmp_u);
change[iters] = self.custom_error.change(u,tmp_u);
current_change = self.custom_error.change(u,tmp_u);
if ignore_error == False:
change[iters] = current_change;
custom_errors[:,iters] = self.custom_error.customerror(u,tmp_u);
u = tmp_u;
change = change[1:iters+1];
custom_errors = custom_errors[:,1:iters+1];
change = current_change if ignore_error else change[1:iters+1];
custom_errors = [] if ignore_error else custom_errors[:,1:iters+1];
return tmp_u, tmp_u.copy(), iters, change, custom_errors;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment