function [fobj,subgrad] = topksum(x,k)
% f(x) = top_k(abs(x))
[n,r] = size(x);
x = x(:);
absx = abs(x);
[sort_absx,ind]=sort(absx,'descend');
fobj = sum(sort_absx(1:k));
I = ind(1:k);
subgrad = zeros(n*r,1);
subgrad(I) = sign(x(I));
subgrad = reshape(subgrad,n,r);



