Suppose I have a class with a property that can be a cvx variable. Is it possible to overload the comparison operators such that they work for cvx?
Here is a minimal example with a class file Test.m:
classdef Test
properties
c
end
methods
function t = Test(c)
t.c = c;
end
function a = ge(x, y)
a = x.c >= y;
end
end
end
The following cvx code
cvx_begin
variable c
T = Test(c);
minimize(c);
subject to
T >= 0;
cvx_end
throws the error:
Undefined function 'newcnstr' for input arguments of type 'cvx'.
Error in >= (line 21)
b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '>=' );
Error in >= (line 12)
a = x.c >= y;