help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] Question about interpolation


From: Daniel J Farrell
Subject: [Help-gsl] Question about interpolation
Date: Tue, 23 Oct 2007 13:26:49 +0100

Hello,

I am using gsl_interp.h functions to look-up the index of a C array which is the nearest to the value, x. However if the value of the x is the maximum value of the array GSL doesn't find it correctly.

Example,

double array[5] = {1,2,3,4,5};

gsl_interp_accel *a = gsl_interp_accel_alloc();
unsigned index = gsl_interp_accel_find (a, array, 5, 5);

//index = 3

This is because (as the docs state, http://www.gnu.org/software/gsl/ manual/html_node/Index-Look_002dup-and-Acceleration.html) the value x must fall into a bin which has the lower value LESS THAN EQUAL TO and an upper value LESS THAN x.

How can I get a return index = 4?

Cheers,

Dan.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]