資源描述:
《低秩矩陣恢復(fù)代碼.doc》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。
1、functionx_out=MSB(Aop,y_vec,s_x,lambda1,rnk,iter)%function[x_outobj_func]=MSB(Aop,y_vec,[mn],lambda1,rnk)%Thiscodesolvestheproblemofrecoveringalowrankmatrixfromits%lowerdimensionalprojections%Minimize
2、
3、X
4、
5、*(nuclearnormofZ)%SubjecttoA(X)=Y%formulatedasanunconst
6、arinednuclearnormminmizationproblemusingSplitbregmanalgorithm%Minmimize(lambda1)
7、
8、W
9、
10、*+1/2
11、
12、A(X)-y
13、
14、_2^2+eta/2
15、
16、W-X-B1
17、
18、_2^2%WisauxillaryvariableandB1isthebregmanvariable%INPUTS%Aop:Linearoperator%y_vec:Vectorofobservedvalues%s_x:sizeofthedatamatrixtoberecover
19、ed(informof[mn])%lambda1:regularizationparameter%rnk:rankestimationforX%iter:maximumnumberofiterationstobecarriedout%OUTPUTS%x_out:recoveredmatrixifnargin<6error('InsufficientNumberofarguments');end%Variableandparameterinitializationeta1=.001;%Regularizationpa
20、rameters_new=s_x(1)*s_x(2);W=zeros(s_new,1);%proxyvariableB1=ones(s_new,1);%bregmanvariable%createoperatorforleastsquaremimimizationI=opDiag(s_new,1);Aop_concat=opStack([1eta1],Aop,I);%runiterativealgorithmforiteration=1:iter%measurementvectorforL2minimization
21、b_vec=[y_vec;eta1*(W-B1)];%L2minimizationstep(subproblem1)X=lsqr(@lsqrAop,b_vec);%NuclearnormminizationStep(subproblem2)W=X+B1;[W,s_thld]=nuc_norm(W,s_x,s_new,lambda1,eta1,rnk);%bregmanvariableupdateB1=B1+X-W;%Objectivefunctionvalueobj_func(iteration)=0.5*norm
22、(y_vec-Aop(X,1))+lambda1*sum(s_thld);ifiteration>10&&abs(obj_func(iteration)-obj_func(iteration-10))<1e-7breakendend%reshapingrecoveredvectortomatrixformx_out=reshape(X,s_x(1),s_x(2));%Plotobjectivefunctionplot(obj_func);title('ConvergenceofObjectiveFunction')
23、xlabel('Numberofiterations');ylabel('Objectivefunctionvalue');functiony=lsqrAop(x,transpose)switchtransposecase'transp'y=Aop_concat(x,2);case'notransp'y=Aop_concat(x,1);endendend