Closed steve3141 closed 10 years ago
My mistake; I don't know what norm(x,1) actually does -- I'd assumed it was the 1-norm (which is true in matlab CVX but not qcml...) What I meant to use was "norm1(x)".
Oh, just in case this confuses anyone in the future: QCML allows
single-argument functions (of vectors) to take multiple arguments by
applying the function row-wise. In other words if a function f
maps a
vector to a scalar, then calling f
on multiple vectors effectively calls:
f(x,y,z) = map(f, zip(x,y,z))
where x
, y
, and z
are vector expressions. This behavior is only for
functions that map vectors to scalars.
The usual example is max
. The expression max(x)
gives a scalar that is
maximum element of the vector x
. The expression max(x,y)
gives the
elementwise maximum between two vectors.
Thus, norm(x,y)
produces a vector
[ ||(x_1, y_1)||_2, ||(x_2, y_2)||_2, ... ]
So the constraint norm(x,1) <= 1
is a vector expression that says
||(x_1,1)||_2 <=1
and ||(x_2,1)||_2 <= 1
. This is strange, but
consistent. As you stated, norm1
is the thing you're looking for. :)
On Wed, Jul 16, 2014 at 8:27 AM, steve3141 notifications@github.com wrote:
Closed #47 https://github.com/cvxgrp/qcml/issues/47.
— Reply to this email directly or view it on GitHub https://github.com/cvxgrp/qcml/issues/47#event-142222391.
Simple example
With b=array([0, 0]) we get solution x=[0, 0] as expected. But b=array([0.3, 0.3]), for example, does not give solution x=b as expected; it gives x=[ 0.0005921, 0.0005921] We'd expect solution to be x=b for b=[a,a] with 0<=a<=0.5. Either I'm missing something -- which is possible -- or there's a bug in the problem setup. I haven't examined the transformations in detail yet but will do and let you know if I find anything. Thanks.