1 Star 0 Fork 323

天信/cybersectookits

forked from openKylin/cybersectookits 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
SVT_sr.m 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
weices 提交于 2023-05-12 08:56 . upload codes
function [ X,iterations ] = SVT_sr(M,P,T,delta,itermax,tol)
%Single value thresholding algorithm,SVT
% function:solve the following optimization problem
% min ||X||*
% s.t. P(X-M) = 0
% X: recovered matrix
% M: observed matrix
% P: sampling set
% T: single value threshold
% output:X,iterations
% initialization
[n1,n2]=size(M);
% Y = zeros(size(M));
Y = P.*M;
iterations = 0;
eta = 1.1; % convergence control parameter
% lambda = 0.001; % regularization parameter
if nargin < 3
T = mean(M(M~=0)); % for speed
% T = sqrt(n1*n2)/0.1; % for accuracy
end
if nargin < 4
delta = 2; % delta: step size
end
if nargin < 5
itermax = 100 ;
end
if nargin < 6
tol = 1.25e-4;
end
for ii = 1:itermax
% singular value threshold operation
[U, S, V] = svd(Y, 'econ') ;
S = sign(S) .*max(abs(S) - T, 0) ; %
X = U*S*V';
% update auxiliary matrix Y
Y = Y + delta* P.* (M-X);
Y = P.*Y ;
% update delta
delta = delta/eta;
% computer error
error = norm( P.* (M-X),'fro' )/norm( P.* M,'fro' );
disp([ii, error]);
if error<tol
break;
end
% update iterations
iterations = ii ;
end
end
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tainsure/cybersectookits.git
git@gitee.com:tainsure/cybersectookits.git
tainsure
cybersectookits
cybersectookits
master

搜索帮助