Next Article in Journal
A Complete Theory of Everything (Will Be Subjective)
Previous Article in Journal
Fluidsim: A Car Traffic Simulation Prototype Based on FluidDynamic
Previous Article in Special Issue
Univariate Cubic L1 Interpolating Splines: Analytical Results for Linearity, Convexity and Oscillation on 5-PointWindows

Algorithms 2010, 3(3), 311-328; https://doi.org/10.3390/a3030311

Article
Univariate Cubic L1 Interpolating Splines: Spline Functional, Window Size and Analysis-based Algorithm
by 1,*, 1,2 and
1
Industrial and Systems Engineering Department, North Carolina State University, Raleigh, NC 27695-7906, USA
2
Mathematical Sciences Division, Army Research Office, Army Research Laboratory, P.O. Box 12211, Research Triangle Park, NC 27709-2211, USA
*
Author to whom correspondence should be addressed.
Received: 11 July 2010 / Accepted: 10 August 2010 / Published: 20 August 2010

## Abstract

:
We compare univariate L1 interpolating splines calculated on 5-point windows, on 7-point windows and on global data sets using four different spline functionals, namely, ones based on the second derivative, the first derivative, the function value and the antiderivative. Computational results indicate that second-derivative-based 5-point-window L1 splines preserve shape as well as or better than the other types of L1 splines. To calculate second-derivative-based 5-point-window L1 splines, we introduce an analysis-based, parallelizable algorithm. This algorithm is orders of magnitude faster than the previously widely used primal affine algorithm.
Keywords:
antiderivative; cubic L1 spline; first derivative; 5-point window; function value; global; interpolation; locally calculated; second derivative; univariate
Classification: MSC:
65D05; 65D07

## 1. Introduction

L1 splines have been shown to provide superior shape preservation for interpolation and approximation of multiscale data, that is, data with sudden large changes in magnitude and/or spacing used for modeling of natural and urban terrain, geophysical features, biological objects, robotic paths and many other irregular surfaces, processes and functions ([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]). The minimization principles for L1 splines have typically (but not uniformly) been based on the L1 norm of the second derivative (rather than on the L1 norm of expressions involving other levels of derivatives). The resulting non-differentiable convex generalized geometric programs have been solved by active set [3], primal affine [5,6,7,10,11] and primal-dual [12,14] algorithms.
In the literature, there are a few indications of limitations of the primal affine and primal-dual algorithms for bivariate L1 splines for large data sets [9,12]. There is also unpublished computational experience of the authors and others who have noticed issues of incomplete convergence or not completely correct convergence of the active set, primal affine and primal-dual algorithms for both univariate and bivariate L1 splines. It is in this context that we seek in this paper a new algorithmic approach for calculating L1 splines. Auquiert, Gibaru and Nyiri [16] have developed a subdifferential-based procedure for calculating second-derivative-based L1 splines on 5-point windows. We propose here an algorithm for second-derivative-based 5-point-window L1 splines based on the analysis in Section 2 of [17], which links, via analytical properties of the spline functional, local geometric properties of 5-point windows of the data set with geometric properties of the L1 spline interpolant.
In considering second-derivative-based 5-point-window L1 splines, three types of information are needed for full “situational awareness,” namely, 1) information about whether use of 5-point windows is superior to use of windows of other sizes and to use of global data sets, 2) information about whether use of the second derivative in the spline functional is superior to use of the first derivative, function value or antiderivative and 3) information about whether the new, analysis-based algorithm mentioned above can achieve computational results superior to those of the primal affine algorithm, which was the previously most widely used algorithm for calculating L1 splines. The third item here has not yet been considered in the literature and the information in the literature on the first and second items is sketchy at best. The computational and analytical results in [2,16,17] do suggest that 5-point windows have advantages vs. global calculations. However, it is not yet known whether windows of other sizes might also have advantages. Results presented in [10,11] indicate that first-derivative-based and function-value-based L1 splines may have advantages over standard second-derivative-based L1 splines. However, these two publications considered only the behavior of L1 splines on the global scale and did not consider behavior on the fine, interval-to-interval scale.
The present paper addresses these needs. In Section 2, we give a brief description of the primal affine algorithm that has previously been widely used to calculate L1 splines. In Section 3, we compare L1 splines calculated by minimizing, on 5-point windows, on 7-point windows and on global data sets, four different spline functionals, namely, ones based on the second derivative, the first derivative, the function value and the antiderivative. These L1 splines are calculated by the primal affine algorithm. The results of this section provide motivation for the development of a new, analysis-based algorithm for calculating 5-point-window, second-derivative-based L1 splines. In Section 4, we present this new algorithm, which is based on the analysis in Section 2 of [17]. In Section 5, we show that, while the results of both the new algorithm and the primal affine algorithm look good on the macro level, there are differences on the micro level. Specifically, the results of the new algorithm are accurate on the micro level while those of the primal affine algorithm are occasionally only approximate. Finally, in Section 6, we summarize the results presented in the previous sections and point out the potential for future algorithms for locally calculated univariate L1 approximating splines and locally calculated bivariate L1 interpolating and approximating splines.
All of the quantities in this paper are real quantities. The nodes $x i$, $i = 0 , 1 , … , I$, are a strictly monotonic but otherwise arbitrary partition of the finite interval $[ x 0 , x I ]$. Let $h i = x i + 1 − x i$. At each node $x i$, the function value $z i$ is given, $i = 0 , 1 , … , I$. The slope of the line segment connecting $( x i , z i )$ and $( x i + 1 , z i + 1 )$ is
$▵ z i : = z i + 1 − z i h i , i = 0 , 1 , … , I − 1 .$
The local and global cubic L1 splines discussed in this paper are cubic polynomials in each interval $( x i , x i + 1 )$, $i = 0 , 1 , … , I − 1$, and are C1 continuous at the nodes. The first derivative of the spline at node $x i$, $i = 0 , 1 , … , I$, is denoted by $b i$ (to be determined by minimization of the L1 spline functional). We use $δ i$ to denote the slope of the chord between neighboring points:
$δ i = z i + 1 − z i − 1 x i + 1 − x i − 1 , i = 1 , 2 , … , I − 1 , δ 0 = z 1 − z 0 h 0 and δ I = z I − z I − 1 h I − 1 .$
We use ζ to denote the linear spline:
$ζ ( x ) = ( x i + 1 − x ) z i + ( x − x i ) z i + 1 h i , x ∈ [ x i , x i + 1 ] , i = 0 , 1 , … , I − 1 .$
For the interpolation problem under consideration in the present paper, the nodes and the function values at the nodes are given. Minimization of a spline functional means “determination of the first derivatives that yield the minimum.” The first derivatives determined from the minimization along with the fixed nodal and functional values yield the piecewise cubic L1 spline by the standard Hermite interpolation formula. For reference, we present here the spline functionals that define traditional, globally calculated L1 splines (“global L1 splines”). Second-derivative-based, first-derivative-based, function-value-based and antiderivative-based cubic L1 splines are calculated by minimizing
$∑ i = 0 I − 1 ∫ x i x i + 1 d 2 z d x 2 d x ,$
$∑ i = 0 I − 1 ∫ x i x i + 1 1 h i d z d x − d ζ d x d x ,$
$∑ i = 0 I − 1 ∫ x i x i + 1 1 h i 2 z − ζ d x$
and
$∑ i = 0 I − 1 ∫ x i x i + 1 1 h i 3 ∫ ( x i + x i + 1 ) / 2 x ( z ( ξ ) − ζ ( ξ ) ) d ξ d x ,$
respectively, over the finite-dimensional spline space of C1 piecewise cubic polynomials z that interpolate the data. The L1 splines that minimize these functionals can be nonunique, a situation that will be handled by adding “regularization terms” to the functionals when they are minimized by the primal affine algorithm or, in the new algorithm proposed in this paper, by applying a “choice procedure” as described below in Section 4. Second-derivative-based L1 splines are the L1 splines commonly encountered in the literature. First-derivative-based L1 splines have been investigated in [10,11]. Function-value-based L1 splines have been treated in [11]. Antiderivative-based L1 splines are newly introduced in this present paper to provide additional insight into how the order of the derivative in the spline functional affects the geometric shape preservation properties of the L1 spline.
In the present paper, computations of different algorithms are based on the following challenging data set consisting of 56 irregular data points that lie on flat, linear, quadratic, cubic and oscillatory functions and on protuberances, patched together with discontinuities of function values and first derivatives and with extreme irregular spacing—with lengths of neighboring intervals differing by up to a factor of 100:
$x = ( 0 , 1 , 2 , 2.01 , 4 , 5 , 6 , 6.01 , 8 , 9 , 10 , 11 , 11.01 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 20.01 , 22 , 23 , 24 , 25 , 26 , 27 , 27.1 , 27.2 , 27.3 , 34.7 , 34.8 , 34.9 , 35 , 36 , 37 , 37.1 37.2 , 37.3 , 44.7 , 44.8 , 44.9 , 45 , 46 , 47 , 48 , 48.1 , 50.9 , 51 , 51.08 , 53 , 55 , 57 , 59 , 60 ) , z = ( 0 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 1 , 1 , 1 , 0 , 0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 0 , 0 , 0 , 2.1725 , 4.29 , 6.3525 , 6.3525 , 4.29 . 2.1725 , 0 , 0 , 0 , 3.081 , 5.928 , 8.547 , − 8.547 , − 5.928 , − 3.081 , 0 , 0 , 0 , 0 , 5 , 3 , 6 , 2 , 7 , 0 , 0 , 0 , 0 ) .$
This data set was used in [11]. The data $( x i , z i )$, $i = 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34$, in the region from x = 27 to x = 45 lie on the the quadratic function 44 − 2.75(x − 31)2. The data $( x i , z i )$, $i = 36 , 37 , 38 , 39 , 40 , 41 , 42 , 43$, in the region from x = 37 to x = 45 lie on the cubic function −16(x − 41) + (x − 41)3. Note the large gaps in the intervals $[ x 30 , x 31 ] = [ 27.3 , 34.7 ]$ and $[ x 39 , x 40 ] = [ 37.3 , 44.7 ]$. In the figures, the data will be represented by dots “·”. The linear spline for these data is given in Figure 1.

## 2. Primal Affine and Other Previously Available Algorithms for L1 Splines

Minimization of the global L1 spline functionals (4), (5), (6) and (7) is a nonlinear programming problem. Direct minimization of (4) has been accomplished by an active set method [3]. Active set algorithms for minimizing (5), (6) and (7) have not been developed, but these functionals and functional (4) have been minimized by primal affine algorithms and primal-dual algorithms [12,14]. Primal affine and primal-dual algorithms are linear (not nonlinear) programming procedures. To create a linear program suitable for application of these algorithms, the integrals in the L1 spline functionals need to be discretized. For the primal affine algorithm used in the present paper and in [5,6,8,10,11], the spline functionals were discretized by the midpoint rule with K equal subintervals in each interval $( x i , x i + 1 )$. In this paper, K = 100. For a detailed description of the primal affine algorithm, see [7].
Figure 1. Data set and linear spline.
Figure 1. Data set and linear spline.
For calculation of L1 splines by the primal affine method using the global functionals (4), (5), (6) and (7), we add to these functionals the regularization terms
$ε ∑ 0 I | b i − δ i | , i = 0 , 1 , … , I .$
When ε is sufficiently small, the L1 spline that minimizes the functional with the regularization term is unique. For the computational experiments of the present paper, ε = 10−4.
In addition to calculating L1 splines by minimizing the global functionals (4), (5), (6) and (7) by the primal affine method, we will calculate L1 splines using these functionals on 5-point and 7-point windows. To calculate the derivative $b i$ of a “windowed” L1 spline at node $x i$, we minimize functionals that are the same as (4), (5), (6) and (7) except that the integral is over a local set of intervals (“window”) rather than over the global domain. For 5-point-window L1 splines, the window $[ x ı ^ − 2 , x ı ^ + 2 ]$ is used for nodes $x ı ^$, $ı ^ = 2 , 3 , … , I − 2$, the window $[ x 0 , x 4 ]$ is used for nodes $x ı ^$, $ı ^ = 0 , 1$ and the window $[ x I − 4 , x I ]$ is used for nodes $x ı ^$, $ı ^ = I − 1 , I$. For 7-point-window $L 1$ splines, the window $[ x ı ^ − 3 , x ı ^ + 3 ]$ is used for nodes $x ı ^$, $ı ^ = 3 , 4 , … , I − 3$, the window $[ x 0 , x 6 ]$ is used for nodes $x ı ^$, $ı ^ = 0 , 1 , 2$ and the window $[ x I − 6 , x I ]$ is used for nodes $x ı ^$, $ı ^ = I − 2 , I − 1 , I$. When minimizing a “windowed” L1 spline functional for node $x ı ^$ by the primal affine algorithm, we add to the spline functional the regularization term
$ε | b ı ^ − δ ı ^ | .$
For the computational experiments of the present paper, ε = 10−4.

## 3. Computational Results for Windowed and Global L1 Splines

A window with an odd number of points is desirable, since it has a “middle point” at which one can use a locally calculated derivative as the derivative of the global interpolant. Conversely, a window with an even number of points is not desirable, because it lacks a middle point. Using the primal affine algorithm described in the previous section, we generated computational results for 5-point-window and 7-point-window L1 splines as well as for global L1 splines.
In the literature, there have been reports [10,11] about L1 splines based on spline functionals involving first derivatives and function values, that is, derivatives of degree lower than the standard second degree. Results in [10,11] suggest that, for global L1 splines, spline functionals based on the first derivative or function value (that is, on functional (5) or (6)) result in improved shape preservation. Those results emphasized overall global preservation of shape on the macro scale but did not treat local preservation of shape on the fine, interval-to-interval scale. Following up on these prior investigations, we revisit here the comparison of L1 splines based on derivatives of degree 2, 1 and 0, add to the comparison L1 splines based on derivatives of degree −1 (antiderivatives) and add the new dimension of considering the window size (5 points, 7 points or global). For this comparison, we use the primal affine algorithm described in Section 2.
Computational results are presented in Figure 2, Figure 3, Figure 4, Figure 5, Figure 6, Figure 7, Figure 8, Figure 9, Figure 10, Figure 11, Figure 12 and Figure 13. In each figure, we highlight in dashed boxes the intervals [25, 27]; [35, 37] and [45, 55], where differences among the various splines are most prominent. The second-derivative-based 5-point-window spline of Figure 2 and the first-derivative-based and function-value-based global splines of Figure 7 and Figure 10 preserve linearity in the intervals [25, 27], [35, 37] and [45, 48] and avoid extraneous overshoot, extraneous undershoot and extraneous oscillation in the interval [48.1, 55]. None of the other nine splines of Figure 2, Figure 3, Figure 4, Figure 5, Figure 6, Figure 7, Figure 8, Figure 9, Figure 10, Figure 11, Figure 12 and Figure 13 is able to preserve linearity and avoid extraneous overshoot, undershoot and oscillation in all of these intervals. In particular, the splines of Figure 3, Figure 4, Figure 8, Figure 11, Figure 12 and Figure 13 do not preserve linearity well on the intervals [25, 27], [35, 37] and/or [45, 48]. The splines of Figure 3, Figure 5, Figure 8 and Figure 11 have extraneous oscillation on the interval [48.1, 50.9]. The splines of Figure 6, Figure 9 and Figure 12 have undershoot in [48.1, 50.9]. The differences in the large intervals [27.3, 34.7] and [37.3, 44.7] is a separate issue that is discussed in the remark below.
Remark The data points immediately to the right and left of the large intervals [27.3, 34.7] and [37.3, 44.7] lie on a quadratic and a cubic function, respectively. The second- and first-derivative-based splines of Figure 2, Figure 3, Figure 4, Figure 5, Figure 6 and Figure 7 approximate both the quadratic and the cubic function. In contrast, the function-value-based and antiderivative-based splines of Figure 8, Figure 9, Figure 10,Figure 11, Figure 12 and Figure 13 avoid approximating the quadratic function in [27.3, 34.7], even though they do approximate the cubic function in [37.3, 44.7]. In classical approximation theory, the ability to approximate or even reproduce quadratic, cubic and higher-degree functions is a goal. In geometric modeling of irregular data, however, reproducing any function of degree higher than 1 is generally considered disadvantageous because it leads to extraneous oscillation, overshoot or undershoot. It is not yet known how to construct L1 splines that generically avoid approximating functions of degree higher than 1. In the present article, we acknowledge this issue but we do not take it into account when assessing the shape-preservation capabilities of the various types of L1 splines.
Figure 2. Second-derivative-based 5-point-window L1 spline
Figure 2. Second-derivative-based 5-point-window L1 spline
Figure 3. Second-derivative-based 7-point-window L1 spline
Figure 3. Second-derivative-based 7-point-window L1 spline
Figure 4. Second-derivative-based global L1 spline
Figure 4. Second-derivative-based global L1 spline
Figure 5. First-derivative-based 5-point-window L1 spline
Figure 5. First-derivative-based 5-point-window L1 spline
Figure 6. First-derivative-based 7-point-window L1 spline
Figure 6. First-derivative-based 7-point-window L1 spline
Figure 7. First-derivative-based global L1 spline
Figure 7. First-derivative-based global L1 spline
Figure 8. Function-value-based 5-point-window L1 spline
Figure 8. Function-value-based 5-point-window L1 spline
Figure 9. Function-value-based 7-point-window L1 spline
Figure 9. Function-value-based 7-point-window L1 spline
Figure 10. Function-value-based global L1 spline
Figure 10. Function-value-based global L1 spline
Figure 11. Antiderivative-based 5-point-window L1 spline
Figure 11. Antiderivative-based 5-point-window L1 spline
Figure 12. Antiderivative-based 7-point-window L1 spline
Figure 12. Antiderivative-based 7-point-window L1 spline
Figure 13. Antiderivative-based global L1 spline
Figure 13. Antiderivative-based global L1 spline
We do not claim here that the results presented in Figure 2, Figure 3, Figure 4, Figure 5, Figure 6, Figure 7, Figure 8, Figure 9, Figure 10, Figure 11, Figure 12 and Figure 13 should yet be broadly interpreted as general descriptions of the shape-preservation capabilities of the various types of L1 splines. However, these results do provide insight into the shape-preservation capabilities of these types of L1 splines as well as a piece of evidence supporting the use of second-derivative-based 5-point-window L1 splines. In these computational results, the performance of second-derivative-based L1 splines, the hitherto most widely used variant of L1 splines is improved by using 5-point windows. The other two “top performers” of Figure 2, Figure 3, Figure 4, Figure 5, Figure 6, Figure 7, Figure 8, Figure 9, Figure 10, Figure 11, Figure 12 and Figure 13, namely, the first-derivative-based and function-value-based global L1 splines of Figure 7 and Figure 10 are computationally much more expensive than second-derivative-based 5-point-window L1 splines. No theory has been published for function-value-based L1 splines. Elementary theory has been published for first-derivative-based L1 splines but only for the global case [15]. Based on these considerations, we choose the second-derivative-based 5-point-window L1 spline as the L1 spline to be used in the remainder of this paper.

## 4. Algorithm for Minimization of Second-derivative-based 5-point-window Spline Functional

We propose here an algorithm for generation of second-derivative-based 5-point-window L1 splines based on the analytical results of Section 2 of [17]. Recall that, in the interpolation situation of interest in this paper, the task of calculating an L1 spline is the task of calculating the first derivatives $b i$ by minimization of a spline functional with given nodes $x i$ and given function values $z i$ at the nodes. In the ith 5-point window, 2 ≤ iI − 2, an objective function $E ( b i − 2 , b i − 1 , b i , b i + 1 , b i + 2 )$ is minimized:
$min b ∈ R 5 E ( b i − 2 , b i − 1 , b i , b i + 1 , b i + 2 ) = min b ∑ j = i − 2 i + 1 ∫ − 1 2 1 2 ( b j + 1 − b j ) + 6 t ( b j + b j + 1 − 2 ▵ z j ) d t .$
In [17], minimization of $E ( b i − 2 , b i − 1 , b i , b i + 1 , b i + 2 )$ is treated as a bilevel minimization problem by representing $b i − 2$, $b i − 1$, $b i + 1$ and $b i + 2$ as functions of $b i$. The optimal $b i$, called $b i *$, is determined by solving
$min b E ( b i − 2 , b i − 1 , b i , b i + 1 , b i + 2 ) = min b i { G 1 ( b i ) + G 2 ( b i ) } ,$
where
$G 1 ( b i ) = 2 ( 10 − 1 ) 3 | b i − 1 ( b i ) − ▵ z i − 2 | + ∫ − 1 2 1 2 ( b i − b i − 1 ( b i ) ) + 6 t ( b i − 1 ( b i ) + b i − 2 ▵ z i − 1 ) d t$
and
$G 2 ( b i ) = 2 ( 10 − 1 ) 3 | b i + 1 ( b i ) − ▵ z i + 1 | + ∫ − 1 2 1 2 ( b i + 1 ( b i ) − b i ) + 6 t ( b i + b i + 1 ( b i ) − 2 ▵ z i ) d t .$
G1(bi) and G2(bi) have similar structure, which leads to the representation
$G 1 ( b i ) + G 2 ( b i ) = G ( b i − ▵ z i − 1 ; ▵ z i − 2 − ▵ z i − 1 ) + G ( b i − ▵ z i ; ▵ z i + 1 − ▵ z i ) ,$
where G(q; c) is a function that is defined and analyzed in [17].
The analysis of [17] is based on the signs of $▵ z i − 2 − ▵ z i − 1$, $▵ z i − 1 − ▵ z i$ and $▵ z i − ▵ z i + 1$. There are 27 cases, as shown in Table 1. For the simple cases, the optimal $b i *$ are listed in the last column of the table. For cases 14, 15, 17, 18, 23, 24, 26 and 27, the $b i *$ will be discussed in Algorithm 1.
Table 1. 27 cases used in the 5-point window algorithm (see [17])
 Case Sign of Same as Case $b i *$ $▵ z i − 1 − ▵ z i − 2$ $▵ z i − ▵ z i − 1$ $▵ z i + 1 − ▵ z i$ 1 0 0 0 $▵ z i − 1$ 2 0 0 + $▵ z i − 1$ 3 0 0 − 2 $▵ z i − 1$ 4 0 + 0 $δ i$ 5 0 + + $▵ z i − 1$ 6 0 + − $▵ z i − 1$ 7 0 − 0 4 $δ i$ 8 0 − + 6 $▵ z i − 1$ 9 0 − − 5 $▵ z i − 1$ 10 + 0 0 2 $▵ z i$ 11 + 0 + $▵ z i − 1$ 12 + 0 − $▵ z i − 1$ 13 + + 0 5 $▵ z i$ 14 + + + [see text] 15 + + − [see text] 16 + − 0 6 $▵ z i$ 17 + − + [see text] 18 + − − 15 [see text] 19 − 0 0 2 $▵ z i$ 20 − 0 + 12 $▵ z i − 1$ 21 − 0 − 11 $▵ z i − 1$ 22 − + 0 6 $▵ z i$ 23 − + + 15 [see text] 24 − + − 17 [see text] 25 − − 0 5 $▵ z i$ 26 − − + 15 [see text] 27 − − − 14 [see text]
Whenever the optimal $b i$ is non-unique at a node $x i$, 2 ≤ iI − 2, we choose the solution $b i *$ to be the real number in the optimal set closest to $δ i$, that is, $median { b i u , b i l , δ i }$. In all 27 cases, the solution is either uniquely determined by a simple expression or lies inside the interval $( ▵ z i − 1 , ▵ z i )$ and can be found by a line search. The expression $G 1 ( b i ) + G 2 ( b i )$ is always continuously differentiable on $( ▵ z i − 1 , ▵ z i )$. When line search is required, the solution of (10) is obtained by solving $d G 1 ( b i ) d b i + d G 2 ( b i ) d b i = 0$. (The explicit form of this expression is provided in [17].) For the results generated in this paper, we used the secant method (previously used in an analogous way in [3]). Calculation of $b i *$ for i = 0, 1, I − 1 and I is carried out differently, as described in Step 3 of Algorithm 2.
The complete algorithm for calculating second-derivative-based 5-point-window L1 splines consists of a subroutine (Algorithm 1) for the local window calculation embedded in an “outer loop” (Algorithm 2) as described in the remainder of this section. Recall that the quantities $δ i$ are defined in (2).
Algorithm 1
(Subroutine($▵ z i − 2 , ▵ z i − 1 , ▵ z i , ▵ z i + 1$; $δ i$)).
STEP 1
Calculate $▵ z i − 2 − ▵ z i − 1$, $▵ z i − 1 − ▵ z i$ and $▵ z i − ▵ z i + 1$ and determine the case to which these quantities correspond.
STEP 2
Calculate $b i *$ using information from [17] contained in Table 1 or described below in this step. Here, $c 1 = ▵ z i − 2 − ▵ z i − 1$ and $c 2 = ▵ z i + 1 − ▵ z i$.
-
In Cases 1, 2, 3, 5, 6, 8, 9, 11, 12, 20 and 21, return $b i * = ▵ z i − 1$.
-
In Cases 10, 13, 16, 19, 22 and 25, return $b i * = ▵ z i$.
-
In Cases 4 and 7, return $b i * = δ i$.
-
Case 14:
Subcase 14-1: If $▵ z i − ▵ z i − 1 ≤ 10 − 2 10 ( | c 1 | + | c 2 | )$, then
$b i * = median { max { ▵ z i − 1 , ▵ z i + 2 − 10 10 c 2 } , min { ▵ z i − 1 + 2 − 10 10 c 1 , ▵ z i } , δ i } .$
Subcase 14-2: If $10 − 2 10 ( | c 1 | + | c 2 | ) < ▵ z i − ▵ z i − 1 < 1 2 ( | c 1 | + | c 2 | )$, then $b i *$ lies in the interval
$max { ▵ z i − 1 + 2 − 10 10 c 1 , ▵ z i − 1 2 c 2 } , min { ▵ z i − 1 − 1 2 c 1 , ▵ z i + 2 − 10 10 c 2 } .$
Use a line search to find $b i *$ such that $d G 1 ( b i * ) d b i + d G 2 ( b i * ) d b i = 0$ in this interval.
Subcase 14-3: If $1 2 ( | c 1 | + | c 2 | ) ≤ ▵ z i − ▵ z i − 1 ≤ 2 ( | c 1 | + | c 2 | )$, then
$b i * = median { max { ▵ z i − 1 − 1 2 c 1 , ▵ z i − 2 c 2 } , min { ▵ z i − 1 − 2 c 1 , ▵ z i − 1 2 c 2 } , δ i } .$
Subcase 14-4: If $2 ( | c 1 | + | c 2 | ) < ▵ z i − ▵ z i − 1$, then $b i *$ lies in the interval
$[ ▵ z i − 1 − 2 c 1 , ▵ z i − 2 c 2 ] .$
Use a line search to find $b i *$ such that $d G 1 ( b i * ) d b i + d G 2 ( b i * ) d b i = 0$ in this interval.
Return $b i *$.
-
Case 15:
Subcase 15-1: If $▵ z i − ▵ z i − 1 ≤ 2 − 10 10 c 1$, then $b i * = ▵ z i$.
Subcase 15-2: If $2 − 10 10 c 1 < ▵ z i − ▵ z i − 1 ≤ − 7 + 10 3 c 1$, then $b i * = ▵ z i$.
Subcase 15-3: If $− 7 + 10 3 c 1 < ▵ z i − ▵ z i − 1$, then $b i *$ lies in the interval
$[ ▵ z i − 1 − 7 + 10 3 c 1 , ▵ z i ] .$
Use a line search to find $b i *$ such that $d G 1 ( b i * ) d b i + d G 2 ( b i * ) d b i = 0$ in this interval.
Return $b i *$.
-
Case 17:
Subcase 17-1: If $▵ z i − 1 − ▵ z i > 10 + 1 3 ( | c 1 | + | c 2 | )$, then $b i *$ lies in the interval
$[ ▵ z i + 10 + 1 3 c 2 , ▵ z i − 1 + 10 + 1 3 c 1 ] .$
Use a line search to find $b i *$ such that $d G 1 ( b i * ) d b i + d G 2 ( b i * ) d b i = 0$ in this interval.
Subcase 17-2: If $▵ z i − 1 − ▵ z i ≤ 10 + 1 3 ( | c 1 | + | c 2 | )$, then
$b i * = median { max { ▵ z i , ▵ z i − 1 + 10 + 1 3 c 1 } , min { ▵ z i − 1 , ▵ z i + 10 + 1 3 c 2 } , δ i } .$
Return $b i *$.
-
In Case 18, let
$( ▵ z i − 2 ′ , ▵ z i − 1 ′ , ▵ z i ′ , ▵ z i + 1 ′ , δ i ′ ) = ( ▵ z i + 1 , ▵ z i , ▵ z i − 1 , ▵ z i − 2 , δ i ) .$
This transforms Case 18 into Case 15. Obtain the optimal solution $b i ′$ of the transformed problem. Return $b i * = b i ′$.
-
In Case 23, let
$( ▵ z i − 2 ′ , ▵ z i − 1 ′ , ▵ z i ′ , ▵ z i + 1 ′ , δ i ′ ) = − ( ▵ z i + 1 , ▵ z i , ▵ z i − 1 , ▵ z i − 2 , δ i ) .$
This transforms Case 23 into Case 15. Obtain the optimal solution $b i ′$ of the transformed problem. Return $b i * = − b i ′$.
-
In Case 24, let
$( ▵ z i − 2 ′ , ▵ z i − 1 ′ , ▵ z i ′ , ▵ z i + 1 ′ , δ i ′ ) = − ( ▵ z i − 2 , ▵ z i − 1 , ▵ z i , ▵ z i + 1 , δ i ) .$
This transforms Case 24 into Case 17. Obtain the optimal solution $b i ′$ of the transformed problem. Return $b i * = − b i ′$.
-
In Case 26, let
$( ▵ z i − 2 ′ , ▵ z i − 1 ′ , ▵ z i ′ , ▵ z i + 1 ′ , δ i ′ ) = − ( ▵ z i − 2 , ▵ z i − 1 , ▵ z i , ▵ z i + 1 , δ i ) .$
This transforms Case 26 into Case 15. Obtain the optimal solution $b i ′$ of the transformed problem. Return $b i * = − b i ′$.
-
In Case 27, let
$( ▵ z i − 2 ′ , ▵ z i − 1 ′ , ▵ z i ′ , ▵ z i + 1 ′ , δ i ′ ) = − ( ▵ z i − 2 , ▵ z i − 1 , ▵ z i , ▵ z i + 1 , δ i ) .$
This transforms Case 27 into Case 14. Obtain the optimal solution $b i ′$ of the transformed problem. Return $b i * = − b i ′$.
STEP 3
Stop.
The “outer loop” (Algorithm 2) consists of repeated or parallel application of Algorithm 1.
Algorithm 2
(Analysis-based Algorithm).
STEP 1
Given a set of points $( x i , z i )$, $i = 0 , 1 , … , I$, calculate $▵ z i$, $i = 0 , … , I − 1$, and $δ i$, $i = 2 , 3 , … , I − 2$, by formulas (1) and (2).
STEP 2
For $i = 2 , 3 , … , I − 2$, calculate $b i *$ using Subroutine($▵ z i − 2 , ▵ z i − 1 , ▵ z i , ▵ z i + 1$;$δ i$) (Algorithm 1).
STEP 3
Set
$b 1 * = ▵ z 1 + min { 10 − 5 7 − 2 10 ( b 2 * − ▵ z 1 ) , 3 10 − 9 7 − 2 10 ( b 2 * − ▵ z 1 ) , ▵ z 0 − ▵ z 1 } , b 0 * = ▵ z 0 + 2 − 10 10 ( b 1 * − ▵ z 1 ) , b I − 1 * = ▵ z I − 2 + min { 10 − 5 7 − 2 10 ( b I − 2 * − ▵ z I − 2 ) , 3 10 − 9 7 − 2 10 ( b I − 2 * − ▵ z I − 2 ) , ▵ z I − 1 − ▵ z I − 2 } , b I * = ▵ z I − 1 + 2 − 10 10 ( b I − 1 * − ▵ z I − 1 ) .$
STEP 4
Stop.

## 5. Analysis-based Algorithm vs. Primal Affine Algorithm for 5-pointWindows

In this section, we compare computational results generated by the analysis-based algorithm introduced in Section 4 and the widely used primal affine algorithm described in Section 2. These results differ significantly (by more than 10−4) at a number of nodes as shown in Table 2. It was confirmed by hand calculation that the results for the analysis-based algorithm are accurate for the original nondiscretized L1 spline functional (a confirmation of both the analysis-based algorithm and the code). The differences in the results produced by the primal affine algorithm and the analysis-based algorithm are due mainly to the discretization (midpoint rule with 100 subintervals, as described in Section 2).
Remark On 5-point windows, the primal affine algorithm converges well. However, for global L1 splines on large data sets, the primal affine algorithm can converge slowly or not at all, especially in bivariate situations, as indicated in Section 6 of [9], a conclusion supported by additional unpublished computational experience of the authors. In such situations, the L1 spline functional may result in a nearly degenerate nonlinear program and this near degeneracy is retained in the discretized version.
Table 2. $b i *$ generated by primal affine algorithm and analysis-based algorithm.
 i $x i$ $b i *$ from primal affine algorithm $b i *$ from analysis-based algorithm 7 6.01 3.4096 3.3874 29 27.2 20.9698 20.9729 30 27.3 19.5166 19.5250 31 34.7 -19.5166 -19.5250 32 34.8 -20.9698 -20.9729 38 37.2 27.5971 27.6099 39 37.3 18.4160 18.4667 40 44.7 18.4160 18.4667 41 44.8 27.5971 27.6099
The analysis-based algorithm introduced in this paper does not require discretization of the L1 spline functional and does not require regularization terms to be added to this functional. The algorithm is simple, accurate and inherently parallelizable. Moreover, it is computationally much cheaper than the primal affine algorithm. Both of the algorithms were implemented in C++ 6.0. Computational results for the data set of Section 1 were generated on an IBM laptop running under the Windows XP operating system at 1.66 GHz CPU with 1.50 GB RAM and were presented in Section 3. The computing times of the primal affine algorithm were
• 177.7 milliseconds for a 5-point window (sequential calculations),
• 335.2 milliseconds for a 7-point window (sequential calculations),
• 94.9 milliseconds for global
for the second-derivative-based L1 splines of Figure 2, Figure 3 and Figure 4, respectively. The computing time of the analysis-based algorithm was
• 0.0531 milliseconds for a 5-point window (sequential calculations)
for the second-derivative-based L1 spline that corresponds to Figure 2. In these computational experiments, the sequential analysis-based algorithm is thus 177.7/0.0531 = 3347 times faster than the sequential primal affine algorithm. The speed-up for the parallel versions of these algorithms would be roughly the same, since each parallel version would be faster than the corresponding sequential version by a factor roughly equal to the number of points in the data set (56 in this case). The sequential analysis-based algorithm is faster than the global primal affine algorithm by a factor of 94.9/0.0531 = 1787. The speed-up of the parallel analysis-based algorithm vs. the global primal affine algorithm would, therefore, be roughly a factor of 1787.2 × 56 ≈ 105, an impressive amount. For larger data sets, the speed-up is correspondingly larger.
Remark The computing time for the primal affine algorithm could be reduced by decreasing the number of subintervals K for discretization (via the midpoint rule) of the spline functional from 100, as was used for the results generated for this paper, to, say, 10, or less. However, since the degree to which a discretized spline functional approximates the continuum spline functional decreases as the number of subintervals is decreased, using only a few subintervals is generally not an advantageous choice when accuracy is an issue, as it is here.

## 6. Conclusion

The results presented here indicate that the new, analysis-based algorithm for calculating univariate second-derivative-based L1 interpolating splines on 5-point windows is a highly computationally efficient algorithm for generating a type of L1 spline that has good shape-preservation properties on the micro scale as well as (generally) the macro scale. The analysis-based algorithm produces computational results that are accurate, in contrast to the widely used primal affine algorithm, which produces computational results that are only approximate. The low computing time and the inherently parallelizable nature of the calculations in the analysis-based algorithm are strong advantages.
The extension of the results in the present paper to algorithms for locally calculated univariate L1 approximating splines and for locally calculated bivariate L1 interpolating and approximating splines is a topic for future research. For approximation, either smoothing splines [4,6,8,9,12] or spline fits [8] could be used. In the bivariate case, analytical results for windows consisting of contiguous triangles or rectangles will have to be developed and, on the basis of those analytical results, algorithms analogous to the univariate algorithm introduced in the present paper will need to be created. The success of the algorithm for univariate interpolation of the present paper indicates that further extension in the directions stated here may be fruitful.

## Acknowledgements

The authors wish to thank Olivier Gibaru and Eric Nyiri of the Ecole Nationale Supérieure d’Arts et Métiers de Lille and Philippe Auquiert of the Université de Valenciennes et du Hainaut-Cambrésis for discussions related to the topic of this paper. The reviewers of this paper provided insightful comments and questions that led to improvements in the paper. This work was generously supported by US Army Research Office Grant # W911NF-04-D-0003, the NCSU Edward P. Fitts Fellowship and US NSF Grant # DMI-0553310.

## References

1. Auquiert, P.; Gibaru, O.; Nyiri, E. C1 and C2-continuous polynomial parametric Lp splines (p ≥ 1). Comput. Aided Geom. Design 2007, 24, 373–394. [Google Scholar] [CrossRef]
2. Auquiert, P.; Gibaru, O.; Nyiri, E. On the cubic L1 spline interpolant to the Heaviside function. Numer. Algorithms 2007, 46, 321–332. [Google Scholar] [CrossRef]
3. Cheng, H.; Fang, S.-C.; Lavery, J.E. An efficient algorithm for generating univariate cubic L1 splines. Comput. Optim. Appl. 2004, 29, 219–253. [Google Scholar] [CrossRef]
4. Cheng, H.; Fang, S.-C.; Lavery, J.E. A geometric programming framework for univariate cubic L1 smoothing splines. Ann. Oper. Res. 2005, 133, 229–248. [Google Scholar] [CrossRef]
5. Lavery, J.E. Univariate cubic Lp splines and shape-preserving, multiscale interpolation by univariate cubic L1 splines. Comput. Aided Geom. Design 2000, 17, 319–336. [Google Scholar] [CrossRef]
6. Lavery, J.E. Shape-preserving, multiscale fitting of univariate data by cubic L1 smoothing splines. Comput. Aided Geom. Design 2000, 17, 715–727. [Google Scholar] [CrossRef]
7. Lavery, J.E. Shape-preserving, multiscale interpolation by bi- and multivariate cubic L1 splines. Comput. Aided Geom. Design 2001, 18, 321–343. [Google Scholar] [CrossRef]
8. Lavery, J.E. Shape-preserving approximation of multiscale univariate data by cubic L1 spline fits. Comput. Aided Geom. Design 2004, 21, 43–64. [Google Scholar] [CrossRef]
9. Lavery, J.E. The state of the art in shape preserving, multiscale modeling by L1 splines. In Proceedings of SIAM Conference on Geometric Design and Computing, Seattle, WA, USA, November 2003; Lucian, M.L., Neamtu, M., Eds.; Nashboro Press: Brentwood, TN, USA, 2004; pp. 365–376. [Google Scholar]
10. Lavery, J.E. Shape-preserving, first-derivative-based parametric and nonparametric cubic L1 spline curves. Comput. Aided Geom. Design 2006, 23, 276–296. [Google Scholar] [CrossRef]
11. Lavery, J.E. Shape-preserving univariate cubic and higher-degree L1 splines with function-value-based and multistep minimization principles. Comput. Aided Geom. Design 2009, 26, 1–16. [Google Scholar] [CrossRef]
12. Lin, Y.-M.; Zhang, W.; Wang, Y.; Fang, S.-C.; Lavery, J.E. Computationally efficient models of urban and natural terrain by non-iterative domain decomposition with L1 smoothing splines. In Proceedings of the 25th Army Science Conference, Department of the Army, Washington, DC, USA, November 2006.
13. Wang, Y.; Fang, S.-C.; Lavery, J.E. A geometric programming approach for bivariate cubic L1 splines. Comput. Math. Appl. 2005, 49, 481–514. [Google Scholar] [CrossRef]
14. Wang, Y.; Fang, S.-C.; Lavery, J.E. A compressed primal-dual method for bivariate cubic L1 splines. Comput. Math. Appl. 2007, 201, 69–87. [Google Scholar] [CrossRef]
15. Zhao, Y.; Fang, S.-C.; Lavery, J.E. Geometric dual formulation for first-derivative-based univariate cubic L1 splines. J. Global Optim. 2008, 40, 589–621. [Google Scholar] [CrossRef]
16. Auquiert, P.; Gibaru, O.; Nyiri, E. Fast L1Ck polynomial spline interpolation algorithm with shape-preserving properties. Comput. Aided Geom. Design 2010, in press. [Google Scholar]
17. Jin, Q.; Lavery, J.E.; Fang, S.-C. Univariate cubic L1 interpolating splines: Analytical results for linearity, convexity and oscillation on 5-point windows. Algorithms 2010, 3, 276–293. [Google Scholar] [CrossRef]
18. Bertsekas, D.P.; Nedić, A.; Ozdaglar, A.E. Convex Analysis and Optimization; Athena Scientific: Belmont, MA, USA, 2003. [Google Scholar]