fusion — [Internal function] Merge 2 increasing sequences using classical programming; used to compute the Legendre-Fenchel conjugate.
fH = fusion(C,S)
Column vector. C(i) = (f(X(i+1) - f(X(i)) / (X(i+1) - X(i)) for some function f on a grid X.
Column vector. The grid on which we want to compute the conjugate: f* is evaluated on S.
Column vector. Index at which the slope S(i) support the epigraph.
Calling fusion(C,S) gives the resulting indices fH(j) where the slope S(j) supports the epigraph of the underlying function f. All in all, it amounts to finding the first index i such that C(i-1) <=S(j) < C(i).
This function uses classical programming i.e. loops to guarantee a linear worst-case running time. See fusionsci for a scilab specific implementation.
This function is not intended to be used directly but to be called during the computation of the conjugate using the LLT algorithm by the function pl_lft_llt.