plq_proj - Piecewise linear quadratic (plq), projection of a (not necessarily convex) function on the set of plq (convex) functions
Computes the projection of the function f on the cone of plq convex functions. Return the result as a plq function.
The computation assumes the function f is sampled on the uniform grid x. The values of the projection are computed by solving the optimization problem: min ||f-u||_p such that u is convex For the L_2 norm, a quadratic program with linear constraints is solved.
n=300; x=linspace(-2,2,n)'; f=abs(abs(x)-1); [p,d]=plq_proj(f,x,2); u=plq_eval(p,x); scf(0);clf(); plot2d(x,f,style=1); plot2d(x,u,style=2); legends(["f","plq"],[1,2],opt="lr"); xtitle(sprintf("Projection of f onto the cone of convex plq functions. ||f-plq||_p=%1.2f",d));
Yves Lucet, University of British Columbia, BC, Canada