Is there a way to write perspective functions?

Is it possible to give perspective functions to CVX as objective function? I know it is possible for particular cases such as t\exp(x/t) or t\log(x/t), but is there a way in general?

You can search for perspective on this forum and see lots of posts showing how to handle various perspective related expressions in CVX. If you do, you’ll even see solutions for a matrix level perspective function, as shown in Perspective of log det function .

Also read the material in and learn and practice clever formulations you can implement using CVX’s DCP rules.

If you’re good and ambitious enough, maybe you can write some functions for CVX which will make it easy to model a variety of perspective functions without requiring the user to implement the contortions themselves. Some are easy to do, such as write a function for x*log(1+y/x) which returns -rel_entr(x,x+y) (which solution is shown in several forum threads, but not automated). As an example of what can be done, look at the CVXQUAD package which adds quantum (matrix) level entropy calculations as an add-on to CVX. I used the quantum_rel_entr function from that package to extend representation of the perspective function x*log(1+y/x) in terms of CVX’s rel_entr to a representation for the matrix version of that using quantum_rel_entr.

If you have a particular perspective function, or class of functions you are interested in, then after searching the forum and giving it a try yourself, feel free to post here asking for help or suggestions. Or if you found a way to do something which hasn’t already been posted, then feel free to post your solution.