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.
_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl