<< plq_plotpa_muSet | plq | plq_rock >>

CCA (Computational Convex Analysis) >> plq > plq_proj

# plq_proj

Piecewise linear quadratic (plq), projection of a (not necessarily convex) function on the set of plq (convex) functions

### Calling Sequence

    [plq,d] = plq_proj(f,x,p)

### Parameters

plq

  matrix. A plq function.

d

  float. distance between the function f and its projection plq functions d=||f-plq||_p.

f

  vector of size n. The values of the function f on the grid x: f=f(x(i)).

x

  vector of size n. The grid on which the function f is evaluated: f=f(x(i)).

p

  integer. The norm for which the projection is computed. p=1, 2, or %inf for the norm ||.||_p.

### Description

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.

### Examples

    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));

### See Also

- plq_function

### Authors

`Yves Lucet`, University of British Columbia, BC, Canada

<< plq_plotpa_muSet | plq | plq_rock >>