max_det_psd_completion.m

来自「斯坦福大学Grant和Boyd教授等开发的凸优化matlab工具箱」· M 代码 · 共 43 行

M
43
字号
% Exercise 4.47: Maximum determinant PSD matrix completion% Boyd & Vandenberghe "Convex Optimization"% Almir Mutapcic - Jan 2006%% Given a symmetric matrix A in R^(n-by-n) with some entries unspecified% we find its completion such that A is positive semidefinite and% it has a maximum determinant out of all possible completions.% This problem can be formulated as a log det (and det_rootn) problem.%% This is a numerical instance of the specified book exercise.% problem sizen = 4;% create and solve the problemcvx_begin sdp  % A is a PSD symmetric matrix (n-by-n)  variable A(n,n) symmetric;  A >= 0;  % constrained matrix entries.  A(1,1) == 3;  A(2,2) == 2;  A(3,3) == 1;  A(4,4) == 5;  % Note that because A is symmetric, these off-diagonal  % constraints affect the corresponding element on the  % opposite side of the diagonal.  A(1,2) == .5;  A(1,4) == .25;  A(2,3) == .75;  % find the solution to the problem  maximize( log_det( A ) )  % maximize( det_rootn( A ) )cvx_end% display solutiondisp(['Matrix A with maximum determinant (' num2str(det(A)) ') is:'])Adisp(['Its eigenvalues are:'])eigs = eig(A)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?