function y = compute_l2ball_projection(x,t) % compute_l2ball_projection - compute the projection on the l2 ball % % y = compute_l2ball_projection(x,t); % % x is the projection of y on the set {a \ ||a|| <= t } % if t<0 error('t should be > 0'); end if t==0 y = x*0; return; end y = x.*min(1,t/norm(x));