Skip to content

Commit

Permalink
admm memory: rhs
Browse files Browse the repository at this point in the history
  • Loading branch information
mblum94 authored and uecker committed Dec 8, 2024
1 parent 40072c2 commit c093bab
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/iter/admm.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ void admm(const struct admm_plan_s* plan,
if (plan->dynamic_rho)
assert(!plan->fast);

float* rhs = vops->allocate(N);

float* z[num_funs ?:1];
float* u[num_funs ?:1];

Expand Down Expand Up @@ -284,6 +282,7 @@ void admm(const struct admm_plan_s* plan,
iter_monitor(monitor, vops, x);

// update x
float* rhs = vops->allocate(N);
vops->clear(N, rhs);

for (int j = 0; j < num_funs; j++) {
Expand Down Expand Up @@ -314,6 +313,8 @@ void admm(const struct admm_plan_s* plan,
iter_op_p_call(xupdate, rho, x, rhs);
ndata.nr_invokes++;

vops->del(rhs);


double n1 = 0.;

Expand Down Expand Up @@ -391,6 +392,8 @@ void admm(const struct admm_plan_s* plan,
r_norm += pow(vops->norm(z_dims[j], r), 2.);
vops->del(r);

float* rhs = vops->allocate(N);

// add next term to s: s = s + Gj^H (zj - zj_old)
vops->sub(z_dims[j], zj_old, z[j], zj_old);
iter_op_call(plan->ops[j].adjoint, rhs, zj_old);
Expand All @@ -399,6 +402,8 @@ void admm(const struct admm_plan_s* plan,
// GH_usum += G_j^H uj (for updating eps_dual)
iter_op_call(plan->ops[j].adjoint, rhs, u[j]);
vops->add(N, GH_usum, GH_usum, rhs);

vops->del(rhs);
}

vops->del(zj_old);
Expand Down Expand Up @@ -526,8 +531,6 @@ void admm(const struct admm_plan_s* plan,


// cleanup
vops->del(rhs);

for (int j = 0; j < num_funs; j++) {

vops->del(z[j]);
Expand Down

0 comments on commit c093bab

Please sign in to comment.