SOFTTH - Computes the proximity operator with respect to the trace norm Syntax function [vv,ss,nsv]=softth(vv, lambda, nsv, verbose); Reference "On the extension of trace norm to tensors" Ryota Tomioka, Kohei Hayashi, and Hisashi Kashima arXiv:1010.0789 http://arxiv.org/abs/1010.0789 Copyright(c) 2010 Ryota Tomioka This software is distributed under the MIT license. See license.txt
0001 % SOFTTH - Computes the proximity operator with respect to the 0002 % trace norm 0003 % 0004 % Syntax 0005 % function [vv,ss,nsv]=softth(vv, lambda, nsv, verbose); 0006 % 0007 % Reference 0008 % "On the extension of trace norm to tensors" 0009 % Ryota Tomioka, Kohei Hayashi, and Hisashi Kashima 0010 % arXiv:1010.0789 0011 % http://arxiv.org/abs/1010.0789 0012 % 0013 % Copyright(c) 2010 Ryota Tomioka 0014 % This software is distributed under the MIT license. See license.txt 0015 0016 0017 function [vv,ss,nsv]=softth(vv, lambda, nsv, verbose); 0018 0019 if ~exist('verbose','var') 0020 verbose=0; 0021 end 0022 0023 0024 sz=size(vv); 0025 nsv=min(min(sz),nsv+1); 0026 0027 if verbose 0028 fprintf('sz=[%d %d]\n',sz(1), sz(2)); 0029 fprintf('nsv='); 0030 end 0031 0032 while 1 0033 if verbose 0034 fprintf('%d/',nsv); 0035 end 0036 [U,S,V]=pca(vv,min(min(sz),nsv),10); 0037 ss=diag(S); 0038 if min(ss)<lambda || nsv==min(sz) 0039 if verbose 0040 fprintf('min(ss)=%g\n',min(ss)); 0041 end 0042 break; 0043 else 0044 nsv=min(min(sz),round(nsv*2)); 0045 end 0046 end 0047 0048 ix=find(ss>=lambda); 0049 ss=ss(ix)-lambda; 0050 vv = U(:,ix)*diag(ss)*V(:,ix)'; 0051 0052 nsv=length(ix);