Bug in interpolation/akima.c.

Gerard Jungman jungman@lanl.gov
Fri Oct 20 13:11:00 GMT 2000


Toby White wrote:
> 
> The offending part is at line 161; inside the loop
> 
>    for (i = 0; i < interp->size; i++)
>      {
>       ...
>       double h_i = x_array[i + 1] - x_array[i];
>       ...
>       }
> 
> However, x_array is generally going to be of length interp->size,
> with obvious consequences on the last loop iteration.

Yup. This was not the only off-by-1 error in akima either.
I think I have fixed them all now. Akima was never really tested
(there were no explicit tests written for it); I added
a rudimentary test for it, similar to the other tests.

We still need more tests in that directory.


I just checked the fixes in.

Thanks.

-- 
G. Jungman


More information about the Gsl-discuss mailing list