Hello,
I have two things I want to mention related to the same problem.
- I came across this problem where I believe I’m using an expression holder as described in the documentation but I’m still getting an error that says there is a conversion problem. The weirder thing is that the minimization works for a specific dimension without throwing an error and throws this error for other dimensions. Here is what it looks like:
cvx_begin
variable u(N^2)
expression coeff(N, N)
coeff = Phi(u);
minimize(norm(coeff, 1))
subject to
norm(A * u - b, 2) <= eta
cvx_end
For example, when u is an 8x8 binary image, there are no problems even if I don’t declare coeff using ‘expression coeff(N, N)’ and at other dimensions like 16x16 or 32x32 for example, I get the following error:
coeff = Phi(u);
^^^^^^^
Caused by:
Error using double
Conversion to double from cvx is not possible.
Also the previous topics related to this error on the forum didn’t really help since I believe I’m correctly using expression.
- I don’t know if it is useful but Phi is a function that takes an NxN image and returns an NxN double image. Nothing in Phi is really specific to the dimension of the image so I’m not sure why it works for some dimensions and not others. There is technically another way I can output a flattened version of what Phi(u) outputs but that requires computing a very large matrix of size (N^2)x(N^2), let’s call it P, and then I can do the minimization:
minimize(norm(P*u, 1))
This actually works for all N but it is unfortunately very slow even for N = 64, and if I’m not mistaken using a function handle like Phi should make things faster if I can make it work for all dimensions. Please let me know if I’m mistaken about this.
Thank you for your help in advance!