I think there is an error when you use piecewise constant (k=1). The results are not the expected. Is it ok?
Also I would like to know if it would be very difficult to modify it and use it for surfaces instead of lines (1D -> 2D).
Eshwar - I considered offering a 5th order or higher fit when I wrote the code. I did not do so however, for valid reasons, at least what I considered valid ones.
- I've only rarely ever needed more than 3rd order. In one such case we were modeling paper paths through a copier, and the path needed to be smoother than a cubic spline could offer.
- Higher orders than a cubic are a serious problem for many of the most useful constraints one may want to apply. Monotonicity for example, is done using a set of necessary constraints based on an inequality from a Fritsch and Carlson paper. Higher orders than cubic however will not allow such a nice solution, so we would have problems ensuring true monotonicity. The curvature constraints would also be more difficult to satisfy.
So in the end, I chose not to implement higher orders than cubic. Sorry.