/* * call-seq: * Dvector.create_spline_interpolant(xs, ys, start_clamped, start_slope, end_clamped, end_slope) -> interpolant * * Uses Dvectors _xs_ and _ys_ to create a cubic spline interpolant. The _xs_ must be given in ascending order. * There is a boundary condition choice to be made for each end concerning the slope. If clamped is true, the * correspdoning slope argument value sets the slope. If clamped is false (known as a "free" or "natural" spline), * the 2nd derivative is set to 0 and the slope is determined by the fit. In this case, the corresponding slope * argument is ignored. The interpolant is an array of Dvectors: [Xs, Ys, As, Bs, Cs]. * For x between Xs[j] and Xs[j+1], let dx = x - Xs[j], and find interpolated y for x by * y = As[j]*dx^3 + Bs[j]*dx^2 + Cs[j]*dx + Ys[j]. * (Spline algorithms derived from Burden & Faires, Numerical Analysis, 4th edition, pp 131 and following.) * */ VALUE dvector_create_spline_interpolant(int argc, VALUE *argv, VALUE klass) {