Hello, I am a new user of Convex.jl and I am trying to port some Matlab code I wrote for CVX.
Basically one of the variables of my problem is a matrix, but my constraints involve not the variable matrix itself, but two other matrices built from elements of the variable matrix. In CVX I would declare these two matrices as expressions, but I do not think I can do that in Convex.jl.
The tricky part is that I have been able to express these two matrices only via a for loop, i.e. element-wise, it is likely that it can be done in a different (vectorized) way, but in CVX it works anyway!
In CVX I did something like this:
cvx_begin sdp
variable x;
variable xsi(n,n) complex;
expression M0(m,m);
expression M1(m,m);
for i=1:m
for j=1:m
a=ranvec(i,:) - ranvec(j,:) + (n+1)/2;
di=(ranvec(i,:)-1)*(2*l)/(n-1) - l;
dj=(ranvec(j,:)-1)*(2*l)/(n-1) - l;
M0(i,j)=xsi(a(1),a(2));
M1(i,j)=M0(i,j)*exp(1j*0.5*(-di(2)*dj(1) + di(1)*dj(2)));
end
end
M0 + x*m*eye(m) >= 0;
M1 >= 0;
cvx_end
Since I can declare M0 and M1 as expressions when I write M1 >= 0
everything is fine. I do not understand how I can do the same in Convex.jlâŚ
I tried doing this
x=Variable()
xsi=ComplexVariable(n,n);
M0=Array(AbstractExpr,m,m);
M1=Array(AbstractExpr,m,m);
then fill the matrices M1 and M0 in the same way but then when I try to add the constraints like constraints= [ M1 in :SDP]
I get some errors:
MethodError: no method matching start(::Symbol)
Closest candidates are:
start(::SimpleVector) at essentials.jl:170
start(::Base.MethodList) at reflection.jl:258
start(::IntSet) at intset.jl:184
...
in mapreduce_sc_impl(::Base.Predicate{Base.##212#213{Array{Convex.AbstractExpr,2}}}, ::Base.#|, ::Symbol) at ./reduce.jl:212
in in(::Array{Convex.AbstractExpr,2}, ::Symbol) at ./reduce.jl:496
Does anything of this make sense? Sorry but I am quite new to this fascinating world of convex optimization.
Thank you in advance for any help you can give me!
Francesco