Given a vector of observations ${\bold{x}} = (x_1, \ldots, x_m)$ with pairwise distinct entries and
a vector of weights ${\bold{w}}=(w_1, \ldots, w_m)$ s.t. $\sum_{i=1}^m w_i = 1$, this function computes a function $\widehat \phi_{MLE}$ (represented by the vector $(\widehat \phi_{MLE}(x_i))_{i=1}^m$) supported by $[x_1, x_m]$ such that
$$L(\phi) = \sum_{i=1}^m w_i \phi(x_i) - \sum_{j=1}^{m-1} (x_{j+1} - x_j) J(\phi_j, \phi_{j+1})$$
is maximal over all continuous, piecewise linear functions with knots in ${x_1, \ldots, x_m}$
LValue $L(\widehat \phi_{MLE})$ of the log-likelihood at $\widehat \phi_{MLE}.$
FhatVector of the same length as ${\bold{x}}$ with entries $\widehat F_{MLE,1} = 0$ and
$$\widehat F_{MLE,k} = \sum_{j=1}^{k-1} (x_{j+1} - x_j) J(\phi_j, \phi_{j+1})$$
for $k \ge 2.$