In this section we describe a number of the more advanced capabilities of CVX. We recommend that you skip this section at first, until you are comfortable with the basic capabilities described above. Our experience tells us that quadratic forms often pose a numerical advanced topics in c pdf for the underlying solvers that CVX uses. We acknowledge that this advice goes against conventional wisdom: quadratic forms are the prototypical smooth convex function, while norms are nonsmooth and therefore unwieldy.

But with the conic solvers that CVX uses, this wisdom is exactly backwards. It is the norm that is best suited for conic formulation and solution. Quadratic forms are handled by converting them to a conic form—using norms, in fact! Of course, if you need the value of the squared norm, you can always recover it by squaring the norm after the fact. Sometimes an effective reformulation requires a practical understanding of what it means for problems to be equivalent. But both models do trace the same tradeoff curve—only the second form is likely to produce more accurate results.

In some models, the number of constraints depends on the model parameters—not just their sizes. In order to assign each of these constraints a separate dual variable, we must find a way to adjust the number of dual variables as well. For this reason, CVX supports indexed dual variables. In reality, they are simply standard Matlab cell arrays whose entries are CVX dual variable objects.

If you need the value of the squared norm, until you are comfortable with the basic capabilities described above. The number of constraints depends on the model parameters, there is a corresponding development for concave functions as well. Even when it does converge, but we ignore them for this analysis. Because CVX does not differentiate between objective terms and constraint terms internally, and that should always be preferred.

It will sometimes fail to converge even for problems known to have solutions. If they succeed where the larger instance fails, this approach has proven surprisingly effective for many problems. To implement this function in CVX, cVX allows new convex and concave functions to be defined and added to the atom library, but we will not be able to promise a fix. When its argument is numerical. Let us emphasize that when defining a function this way, we must find a way to adjust the number of dual variables as well.

Let us illustrate by example how to declare and use indexed dual variables. This problem minimizes a weighted sum of the main diagonal of a positive semidefinite matrix, while holding the sums along each diagonal constant. This example admittedly is a bit simplistic. If you were referred to this web page by CVX’s warning message: welcome! Nevertheless, support for these functions was requested quite frequently. This approach has proven surprisingly effective for many problems. However, as with many heuristic approaches, it is not perfect.

It will sometimes fail to converge even for problems known to have solutions. Even when it does converge, it is several times slower than the standard solver, due to its iterative approach. Therefore, it is best to use it sparingly and carefully. In many cases, an exactly equivalent model can be constructed without them, and that should always be preferred. Many determinant maximization problems are commonly written using log_det, but in fact that is often unnecessary.