pl_lft_direct — [For comparison only] Legendre-Fenchel conjugate, direct computation
Conj = pl_lft_direct(X,Y,S)
column vector. A grid of points on which the function is sampled.
column vector. The value of the function on the grid X: usually Y(i)=f(X(i)) for some function f.
column vector. The grid on which we want to compute the conjugate: f* is evaluated on S.
column vector. Contains the value of the conjugate f* of the function f evaluated at the points S(j). In other words: Conj(j) = Max(S(j) * X(i) - Y(i) | over all indexes i)
Warning: This function is provided only for comparison purposes and unit testing, use the more efficient pl_lft_llt or pl_lft_plt for faster computation.
Compute numerically the discrete Legendre transform of a set of planar points (X(i),Y(i)) at slopes S, i.e.,
Conj(j)=max[S(j)*X(i)-Y(i)]. i
It uses straight computation for a quadratic-time algorithm theta(n*m) with n=length(X)=length(Y) and m=length(S).
</listitem>S=(-10:1:10)'; X1=(-2:0.2:2)';f=abs(X1);C1 = pl_lft_direct(X1, f, S); X2=(-4:0.4:4)';f=abs(X2);C2 = pl_lft_direct(X2, f, S); X3=(-8:0.8:8)';f=abs(X3);C3 = pl_lft_direct(X3, f, S); X4=(-160:16:160)';f=abs(X4);C4 = pl_lft_direct(X4, f, S); scf(0);clf; plot2d([S S S S],[C1 C2 C3 C4],rect=[-3,-0.5,3,10]); xtitle("Convergence of the discrete Legendre transform of the absolute value to the indicator of [-1,1]");