Indexing and slicing in QMCL problem strings
Closed this issue · 1 comments
JosepVirgili commented
Is there a way to slice and perform operations on the variables on the problem string.
I am looking for something similar to what is possible in CVXPY:
http://www.cvxpy.org/en/latest/tutorial/functions/index.html?highlight=slicing#indexing-and-slicing
I would like to add constraints that contain a norm of a subset of a variable. Something like:
norm(x[4:5],2)<=2
echu commented
I don't think there is, and that may have been a function of the ambiguity
involved when a function is applied to, say, a sliced data matrix (sliced
variables are straightforward).
In the meantime, there's two approaches:
If you need slicing, you have to declare a second variable and expand all
the equations manually. For instance, Ax might become A1 x1 + A2 x2, where
A = [A1 A2] and x = [x1; x2].
Another possibility is to declare a data matrix that does the slicing for
you ( S=[0, 0; 0, 1] ) and use Sx where you need the slicing.
Hope that helps!
…On Thu, Jun 29, 2017 at 11:40 AM Josep Virgili ***@***.***> wrote:
Is there a way to slice and perform operations on the variables on the
problem string.
I am looking for something similar to what is possible in CVXPY:
http://www.cvxpy.org/en/latest/tutorial/functions/index.html?highlight=slicing#indexing-and-slicing
I would like to add constraints that contain a norm of a subset of a
variable. Something like:
norm(x[4:5],2)<=2
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#56>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADN0SyMo14OQgy8pEwDsum6agxmFxdRks5sI--2gaJpZM4OJtdX>
.