
function alpha_j=Thresholding(Tjg_hat,Lambda_j,Thresh)
%{
temp=Tjg_hat-Thresh;
ind=find(temp>0);
svp=length(ind);
alpha_j=Tjg_hat(ind);
%}

Tjg_hat=Tjg_hat+Lambda_j;
alpha_j=Tjg_hat;
alpha_j(abs(alpha_j)<Thresh)=0;

%{
Tjg_hat=Tjg_hat+Lambda_j;
temp0=Tjg_hat-2*sqrt(Thresh);
temp1=Tjg_hat+2*sqrt(Thresh);
temp=Tjg_hat.^2-4*Thresh;
ind0=temp0>0;
ind1=temp1<0;
alpha_j=zeros(size(Tjg_hat));
alpha_j(ind0)=(Tjg_hat(ind0)+sqrt(temp(ind0)))/2;
alpha_j(ind1)=(Tjg_hat(ind1)-sqrt(temp(ind1)))/2;
%}
end
