PDL::Slatec is a PDL interface to the slatec numerical programming library.
($ndeg, $r, $ierr, $a) = polyfit($x, $y, $w, $maxdeg, $eps);
This module serves the dual purpose of providing an interface to parts of the slatec library and showing how to interface PDL to an external library. Using this library requires a fortran compiler; the source for the routines is provided for convenience.
Currently available are routines to: manipulate matrices; calculate FFT's; fit data using polynomials; and interpolate/integrate data using piecewise cubic Hermite interpolation.
Piecewise cubic Hermite interpolation (PCHIP)
PCHIP is the slatec package of routines to perform piecewise cubic Hermite interpolation of data. It features software to produce a monotone and "visually pleasing" interpolant to monotone data. According to Fritsch & Carlson ("Monotone piecewise cubic interpolation", SIAM Journal on Numerical Analysis 17, 2 (April 1980), pp. 238-246), such an interpolant may be more reasonable than a cubic spline if the data contains both "steep" and "flat" sections. Interpolation of cumulative probability distribution functions is another application. These routines are cryptically named (blame FORTRAN), beginning with 'ch', and accept either float or double piddles.
Most of the routines require an integer parameter called check; if set to 0, then no checks on the validity of the input data are made, otherwise these checks are made. The value of check can be set to 0 if a routine such as chim has already been successfully called.
If not known, estimate derivative values for the points using the chim, chic, or chsp routines (the following routines require both the function (f) and derivative (d) values at a set of points (x)).
Evaluate, integrate, or differentiate the resulting PCH function using the routines: chfd; chfe; chia; chid.
If desired, you can check the monotonicity of your data using chcm.
EOD # ' un-confuse emacs
# if define chbs, then add something like the following to point 3: # # or use chbs to convert a PCH function into B-representation # for use with the B-spline routines of slatec # (although no interface to them currently exist). #
# add function definitions after finishing the first pp_addpm(), since this # adds a '=head1 FUNCTIONS' line at the end of the text