Scilab Function
Last update : 12/4/2006
lft_llt - Legendre-Fenchel conjugate, LLT algorithm
Calling Sequence
-
Conj = lft_llt(X,Y,S,fusionopt)
Parameters
-
X
: column vector. A grid of points on which the function is sampled.
-
Y
: column vector. The value of the function on the grid X: usually Y(i)=f(X(i)) for some function f.
-
S
: column vector. The grid on which we want to compute the conjugate: f* is evaluated on S.
-
fusionopt
: Optional. integer. Select the implementation of the fusion algorithm. fusionopt=1 (or omitted) selects fusionsci, a fast implementation using scilab syntax but with nonlinear complexity. Any over value selects the fusion implementation, a (slower) loop-based implementation that runs in linear-time.
-
Conj
: column vector. Contains the value of the conjugate f* of the function f evaluated on at the points S(j). In other words: Conj(j) = Max(S(j) * X(i) - Y(i) | over all indexes i)
Description
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 the Linear-time Legendre Transform (LLT) algorithm for a linear-time worst-case complexity theta(n+m) with n=length(X)=length(Y) and m=length(S). The LLT algorithm first compute the lower convex envelope of the points (X(i),Y(i)), and then merge two increasing sequences.
Examples
X=[-5:0.5:5]';
Y=X.^2;
S=(Y(2:size(Y,1))-Y(1:size(Y,1)-1))./(X(2:size(X,1))-X(1:size(X,1)-1));
Conj=lft_llt(X,Y,S);
Conj2=lft_llt(X,Y,S,1);
See Also
lft_direct
,
Author
Yves Lucet, University of British Columbia, BC, Canada
Bibliography
Y. Lucet, 1997, Faster than the fast Legendre transform, the linear-time Legendre transform, Numerical Algorithms, 16(2):171-185. Code in Netlib.
Used Function
The convex hull computation is performed with the function
bb
. The core of the algorithm amounts to merging to increasing sequences is performed with the function
fusion
or
fusionsci
depending on the value of the parameter fusionopt.