📄 upperbounds.m
字号:
function [bnds,rhov,dualvals]=UpperBounds(A,S,res)% Compute upper bounds on the sparse maximum eigenvalue problem% Input: % S: a covariance matrix% A: its factorization with S=A'*A% Output: % bnds: upper bounds from the dual of the card. contrained max eig problem% rhov: the corresponding penalties% dualvals: the dual objective values of the card. penalized max eig problemdisp('Compute upper bounds on variance...');ds=diag(S);if any(ds(1:end-1)-ds(2:end)<0) disp('Error in upper bounds: diagonal of input matrix should be decreasing'); bnds=[];rhov=[];return;endif norm(A'*A-S)>1e-12; disp('Error in upper bounds: A not factor of S'); bnds=[];rhov=[];return; enddualvals=[];rhov=[];optrep=[];% Compute best dual values for each variable subsetkp=size(res,2);for i=1:kp csubset=res(find(res(:,i)),i); [isopt,rho]=TestOptimalityDual(A,S,csubset); dv=dualvalue(A,S,rho,csubset); optrep=[optrep;isopt];dualvals=[dualvals,dv];rhov=[rhov;rho];end% Also add full and empty setdualvals=[dualvals,max(eig(S))];rhov=[rhov;0];dualvals=[dualvals,0];rhov=[rhov;max(diag(S))];% Compute boundscards=sum(res>0);primalbnds=dualvals'*ones(1,kp)+rhov*cards;bnds=min(primalbnds);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -