www.pudn.com > RobustSF.zip > compute_representation.m, change:2014-09-01,size:1284b


function [X] = compute_representation(Y, D, alpha, tol, max_iter) 
 
addpath PROPACK; 
 
iter = 0; 
converged1 = false; 
converged2 = false; 
 
[m,n]=size(Y); 
[dm,dn]=size(D); 
 
Y1=zeros(m,n); 
X=zeros(dn,n); 
pre_X=X; 
E=zeros(m,n); 
 
 
mu1 =1e-1;% 0.5; 
rho = 1.7; 
yita = norm(D,2); 
yita = yita*yita; 
mu_bar=1e+8; 
para=alpha/yita; 
%% IALM 
while ~converged1 || ~converged2 
    iter = iter + 1; 
   
    %% updata X 
    [U, S, V] = svd(pre_X+D'*(Y-E+Y1/mu1)/yita); 
    diagS = diag(S); 
    svp = length(find(diagS > para/mu1)); 
    pre_X = X; 
    X= U(:, 1:svp) * diag(diagS(1:svp) -  para/mu1) * V(:, 1:svp)'; 
     
    %% update E 
    E=(Y-D*X+Y1/mu1)/(mu1/(2+mu1)); 
     
     
    %% stop criterion 
    converged1 = false; 
    temp1=Y-D*X-E; 
    stopCriterion1 = norm(temp1, 'fro'); 
    if stopCriterion1< tol 
        converged1 = true; 
    end  
     
    converged2 = false; 
    stopCriterion3 = norm(pre_X-X, 'fro'); 
    if stopCriterion3< tol 
        converged2 = true; 
    end  
     
    %% update mu1 and mu2 
    mu1 = min(mu1*rho, mu_bar); 
     
    %% update Y 
    Y1 = Y1 + mu1*temp1;     
    
 
    if (~converged1 || ~converged2) && iter >= max_iter 
        disp('Maximum iterations reached') ; 
        break;    
    end 
end