function [x_new, z_new, u_new, primalResidual, dualResidual] = ADMM_convex_step(samples, labels, rho, lambda, x_previous, z_previous, u_previous, x_edge, u_edge, c)
% 
% ADMM_convex_step(samples, labels, rho, lambda, x_previous, z_previous, u_previous, x_edge, u_edge)
% Perform a step for 1 node
% 

% Check the input

[nbSamples, spaceDim] = size(samples);

assert(length(labels) == nbSamples);
assert(spaceDim >= 1);
assert(lambda >= 0);
assert(min(labels) == -1);
assert(max(labels) == 1);

assert(rho >= 0);

[m, n] = size(x_previous);
assert(m == spaceDim +1);
assert(n == 1);

[a, N_i] = size(z_previous);
[d, e] = size(u_previous);
assert(a == m);
assert(N_i == e);
assert(d == m);

[s, t] = size(x_edge);
[u, v] = size(u_edge);
assert(s == m);
assert(u == m);
assert(t == N_i);
assert(v == N_i);

% Create a unitary weight vector
w = ones(1, N_i);

% % % 
% Perfom one ADMM steps, for a given lambda
% % % 

    
x_new = x_step(samples, labels, rho, z_previous, u_previous, c);
z_new = z_step(x_new, u_previous, w', rho, x_edge, u_edge, lambda);
u_new = u_step(x_new, u_previous, z_new);

% Compute the residuals

x_rep = repmat(x_new, [1, N_i]);
primalResidual = sqrt( max( diag( (x_rep-z_new)'*(x_rep-z_new) ) ) );
dualResidual = norm(x_new - x_previous, 2);    






end