l1_softth - soft threshold function for L1 regularization Copyright(c) 2009 Ryota Tomioka This software is distributed under the MIT license. See license.txt
0001 % l1_softth - soft threshold function for L1 regularization 0002 % 0003 % Copyright(c) 2009 Ryota Tomioka 0004 % This software is distributed under the MIT license. See license.txt 0005 0006 function vv=l1_softth(vv,lambda,info) 0007 0008 n = size(vv,1); 0009 0010 Ip=find(vv>lambda); 0011 In=find(vv<-lambda); 0012 0013 vv=sparse([Ip;In],1,[vv(Ip)-lambda;vv(In)+lambda],n,1);