gsl_cspline_init bug?
R. Sean Bowman
sean@rootnode.com
Tue Nov 5 23:11:00 GMT 2002
hello
I think I've found a bug in gsl_cspline_init. It appears to want a
minimum of two points, but in this case a variable "sys_size" gets set to
0 in gsl_cspline_init, which somebody doesn't like later. I get the
message
gsl: view_source.c:28: ERROR: vector length n must be positive integer
Default GSL error handler invoked.
Aborted
Attached is a small program which elicits this behavior on my linux box.
Isn't this a problem? Shouldn't csplines need more than two points to do
interpolation?
Thanks a bunch!
Sean
-------------- next part --------------
#include <stdlib.h>
#include <math.h>
#include <gsl/gsl_errno.h>
#include <gsl/gsl_spline.h>
#define PTS 2
int main (int argc, char** argv){
int i;
double xi, yi, x[PTS], y[PTS];
for (i = 0; i < PTS; i++){
x[i] = i + 0.5 * sin (i);
y[i] = i + cos (i * i);
}
{
gsl_interp_accel *acc = gsl_interp_accel_alloc ();
gsl_spline *spline = gsl_spline_alloc (gsl_interp_cspline, PTS);
gsl_spline_init (spline, x, y, PTS);
gsl_spline_free (spline);
gsl_interp_accel_free(acc);
}
return 0;
}
More information about the Gsl-discuss
mailing list