https://github.com/vegarant/spgl1
Tip revision: 5b6ee1e77c0a24b8f50d6462478cc2a5b09f5622 authored by Michael Friedlander on 26 April 2016, 15:40:32 UTC
Move webpage to UBC.
Move webpage to UBC.
Tip revision: 5b6ee1e
NormGroupL2_project.m
function x = NormGroupL2_project(groups,x,weights,tau)
% Projection binary group matrix
% Compute two-norms of rows
if isreal(x)
xa = sqrt(sum(groups * x.^2,2));
else
xa = sqrt(sum(groups * abs(x).^2,2));
end
% Project one one-norm ball
idx = xa < eps;
xc = oneProjector(xa,weights,tau);
% Scale original
xc = xc ./ xa; xc(idx) = 0;
x = full(groups' * xc).*x;