Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121755656
simple_LS.html
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jul 13, 16:02
Size
3 KB
Mime Type
text/html
Expires
Tue, Jul 15, 16:02 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27354538
Attached To
R1252 EMPoWER
simple_LS.html
View Options
<!DOCTYPE HTML>
<html>
<head>
<meta
charset=
"UTF-8"
>
<title>
Builds and solves a simple least-squares problem using cvx
</title>
<link
rel=
"canonical"
href=
"http://cvxr.com/cvx/examples/html/simple_LS.html"
>
<link
rel=
"stylesheet"
href=
"../examples.css"
type=
"text/css"
>
</head>
<body>
<div
id=
"header"
>
<h1>
Builds and solves a simple least-squares problem using cvx
</h1>
Jump to:
<a
href=
"#source"
>
Source code
</a>
<a
href=
"#output"
>
Text output
</a>
Plots
<a
href=
"../index.html"
>
Library index
</a>
</div>
<div
id=
"content"
>
<a
id=
"source"
></a>
<pre
class=
"codeinput"
>
echo
<span
class=
"string"
>
on
</span>
n = 100;
A = randn(2*n,n);
b = randn(2*n,1);
cvx_begin
variable
<span
class=
"string"
>
x(n)
</span>
minimize( norm( A*x-b ) )
cvx_end
echo
<span
class=
"string"
>
off
</span>
</pre>
<a
id=
"output"
></a>
<pre
class=
"codeoutput"
>
n = 100;
A = randn(2*n,n);
b = randn(2*n,1);
cvx_begin
variable x(n)
minimize( norm( A*x-b ) )
cvx_end
Calling SDPT3: 201 variables, 101 equality constraints
For improved efficiency, SDPT3 is solving the dual problem.
------------------------------------------------------------
num. of constraints = 101
dim. of socp var = 201, num. of socp blk = 1
*******************************************************************
SDPT3: Infeasible path-following algorithms
*******************************************************************
version predcorr gam expon scale_data
NT 1 0.000 1 0
it pstep dstep pinfeas dinfeas gap prim-obj dual-obj cputime
-------------------------------------------------------------------
0|0.000|0.000|6.6e+00|1.5e+00|2.5e+02| 0.000000e+00 0.000000e+00| 0:0:00| chol 1 1
1|0.957|1.000|2.9e-01|6.6e-03|2.3e+01|-9.691971e+00 -2.045281e+01| 0:0:00| chol 1 1
2|1.000|1.000|7.3e-08|6.6e-04|1.4e+00|-8.725326e+00 -1.014181e+01| 0:0:00| chol 1 1
3|0.985|0.986|1.8e-08|7.5e-05|2.1e-02|-9.515525e+00 -9.535125e+00| 0:0:00| chol 1 1
4|0.989|0.989|5.6e-09|7.4e-06|2.3e-04|-9.527047e+00 -9.527166e+00| 0:0:00| chol 1 1
5|0.989|0.989|6.2e-11|8.2e-08|2.5e-06|-9.527175e+00 -9.527176e+00| 0:0:00| chol 1 1
6|0.989|0.989|1.0e-12|9.1e-10|2.8e-08|-9.527176e+00 -9.527176e+00| 0:0:00|
stop: max(relative gap, infeasibilities)
<
1.49e-08
-------------------------------------------------------------------
number of iterations = 6
primal objective value = -9.52717641e+00
dual objective value = -9.52717642e+00
gap := trace(XZ) = 2.81e-08
relative gap = 1.40e-09
actual relative gap = 7.16e-10
rel. primal infeas = 1.00e-12
rel. dual infeas = 9.13e-10
norm(X), norm(y), norm(Z) = 1.4e+00, 9.6e+00, 1.3e+01
norm(A), norm(b), norm(C) = 1.4e+02, 2.0e+00, 1.5e+01
Total CPU time (secs) = 0.11
CPU time per iteration = 0.02
termination code = 0
DIMACS: 1.0e-12 0.0e+00 3.5e-09 0.0e+00 7.2e-10 1.4e-09
-------------------------------------------------------------------
------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +9.52718
echo off
</pre>
</div>
</body>
</html>
Event Timeline
Log In to Comment