Subindex error for the class cvx

I don’t know what w is, but you’re not going to be able to specify a nonlinear equality constraint in CVX.

If you need such an equality constraint, and you’re just doing a one-time solution, you could always specify it as a <= and see if equality happens to be satisfied, in which case you’re done. Or perhaps you can concoct some kind of penalty function, expressible in CVX, and the iterate on penalty parameter to get your desired solution.

Another approach, and I have NO idea if it will work (converge, and if so, to even a local minimum, and you can forget about guarantee of global minimum), is to use a <= constraint, and add a modified >= constraint, per stephen_boyd’s answer in How to handle nonlinear equality constraints? , and then iterate as per that answer.