/* Interpolates the value of the function at the points given.
Returns a brand new Dvector. The X values must be sorted !
*/
static VALUE function_compute_spline(VALUE self, VALUE x_values)
{
VALUE x_vec = get_x_vector(self);
VALUE y_vec = get_y_vector(self);
VALUE cache;
VALUE ret_val;
long dat_size = function_sanity_check(self);
long size = DVECTOR_SIZE(x_values);
function_ensure_spline_data_present(self);
cache = get_spline_vector(self);
ret_val = rb_funcall(cDvector, rb_intern("new"),
1, LONG2NUM(size));
double * x_dat = Dvector_Data_for_Read(x_vec,NULL);
double * y_dat = Dvector_Data_for_Read(y_vec,NULL);
double * spline = Dvector_Data_for_Read(cache,NULL);
double * x = Dvector_Data_for_Read(x_values,NULL);
double * y = Dvector_Data_for_Write(ret_val,NULL);
function_compute_spline_interpolation(dat_size, x_dat,
y_dat, spline,
size, x, y);
return ret_val;
}