Page MenuHomec4science

min_phase_spectral_fact.html
No OneTemporary

File Metadata

Created
Tue, Jul 8, 14:26

min_phase_spectral_fact.html

<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Minimal phase spectral factorization</title>
<link rel="canonical" href="http://cvxr.com/cvx/examples/html/min_phase_spectral_fact.html">
<link rel="stylesheet" href="../examples.css" type="text/css">
</head>
<body>
<div id="header">
<h1>Minimal phase spectral factorization</h1>
Jump to:&nbsp;&nbsp;&nbsp;&nbsp;
<a href="#source">Source code</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="#output">Text output</a>
&nbsp;&nbsp;&nbsp;&nbsp;
Plots
&nbsp;&nbsp;&nbsp;&nbsp;<a href="../index.html">Library index</a>
</div>
<div id="content">
<a id="source"></a>
<pre class="codeinput">
<span class="comment">% A PSD matrix is found which minimizes a weighted trace while obtaining</span>
<span class="comment">% fixed sums along the diagonals. Notice the use of a FOR loop to access</span>
<span class="comment">% the diagonals of X. A later version of CVX will eliminate the need for</span>
<span class="comment">% this by allowing the use of the SPDIAGS function in side models.</span>
<span class="comment">% Nevertheless, this example provides an illustration of the use of</span>
<span class="comment">% standard Matlab control statements to build models.</span>
<span class="comment">%</span>
<span class="comment">% Adapted from an example provided in the SeDuMi documentation.</span>
<span class="comment">% Generate data</span>
b = [2; 0.2; -0.3];
n = length( b );
<span class="comment">% Create and solve model</span>
cvx_begin <span class="string">sdp</span>
variable <span class="string">X( n, n )</span> <span class="string">symmetric</span>
dual <span class="string">variable</span> <span class="string">y{n}</span>
dual <span class="string">variable</span> <span class="string">Z</span>
minimize( ( n - 1 : -1 : 0 ) * diag( X ) );
<span class="keyword">for</span> k = 1 : n,
sum( diag( X, k - 1 ) ) == b( k ) : y{k};
<span class="keyword">end</span>
X &gt;= 0 : Z;
cvx_end
y = [ y{:} ]';
<span class="comment">% Display resuls</span>
disp( <span class="string">'The optimal point, X:'</span> );
disp( X )
disp( <span class="string">'The diagonal sums:'</span> );
disp( sum( spdiags( X, 0:n-1 ), 1 ) );
disp( <span class="string">'min( eig( X ) ) (should be nonnegative):'</span> );
disp( min( eig( X ) ) )
disp( <span class="string">'The optimal weighted trace:'</span> );
disp( ( n - 1 : -1 : 0 ) * diag( X ) );
</pre>
<a id="output"></a>
<pre class="codeoutput">
Calling SDPT3: 6 variables, 3 equality constraints
For improved efficiency, SDPT3 is solving the dual problem.
------------------------------------------------------------
num. of constraints = 3
dim. of sdp var = 3, num. of sdp blk = 1
*******************************************************************
SDPT3: Infeasible path-following algorithms
*******************************************************************
version predcorr gam expon scale_data
HKM 1 0.000 1 0
it pstep dstep pinfeas dinfeas gap prim-obj dual-obj cputime
-------------------------------------------------------------------
0|0.000|0.000|6.9e-01|5.3e+00|3.0e+02| 2.000000e+01 0.000000e+00| 0:0:00| chol 1 1
1|1.000|1.000|2.5e-07|5.7e-02|1.9e+01| 1.882061e+01 2.306667e+00| 0:0:00| chol 1 1
2|0.921|1.000|1.4e-07|5.7e-03|1.5e+00| 4.040616e+00 2.524843e+00| 0:0:00| chol 1 1
3|1.000|0.859|8.8e-08|1.3e-03|3.7e-01| 4.105341e+00 3.748230e+00| 0:0:00| chol 1 1
4|0.983|0.985|1.9e-08|7.5e-05|6.0e-03| 3.880804e+00 3.875203e+00| 0:0:00| chol 1 1
5|0.988|0.988|4.9e-10|6.4e-06|7.0e-05| 3.877308e+00 3.877275e+00| 0:0:00| chol 1 1
6|0.986|0.988|6.1e-12|7.7e-08|9.2e-07| 3.877268e+00 3.877268e+00| 0:0:00| chol 1 1
7|1.000|1.000|3.3e-14|1.2e-12|3.7e-08| 3.877267e+00 3.877267e+00| 0:0:00|
stop: max(relative gap, infeasibilities) &lt; 1.49e-08
-------------------------------------------------------------------
number of iterations = 7
primal objective value = 3.87726745e+00
dual objective value = 3.87726741e+00
gap := trace(XZ) = 3.73e-08
relative gap = 4.26e-09
actual relative gap = 4.26e-09
rel. primal infeas = 3.26e-14
rel. dual infeas = 1.21e-12
norm(X), norm(y), norm(Z) = 2.4e+00, 1.9e+00, 2.0e+00
norm(A), norm(b), norm(C) = 3.8e+00, 3.2e+00, 3.1e+00
Total CPU time (secs) = 0.08
CPU time per iteration = 0.01
termination code = 0
DIMACS: 3.5e-14 0.0e+00 1.2e-12 0.0e+00 4.3e-09 4.3e-09
-------------------------------------------------------------------
------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +0.122733
The optimal point, X:
0.0468 -0.0369 -0.3000
-0.0369 0.0292 0.2369
-0.3000 0.2369 1.9240
The diagonal sums:
2.0000 0.2000 -0.3000
min( eig( X ) ) (should be nonnegative):
5.7391e-09
The optimal weighted trace:
0.1227
</pre>
</div>
</body>
</html>

Event Timeline