This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: gsl_cspline_init bug?
- From: Gerard Jungman <jungman at lanl dot gov>
- To: "R. Sean Bowman" <sean at rootnode dot com>
- Cc: gsl-discuss at sources dot redhat dot com
- Date: 06 Nov 2002 14:31:35 -0700
- Subject: Re: gsl_cspline_init bug?
- References: <20021105204213.H10500-200000@exigence.rootnode.com>
Fixed in CVS.
Thanks for the report.
--
G. Jungman
On Tue, 2002-11-05 at 19:42, R. Sean Bowman wrote:
> 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
>
> ----
>
> #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;
> }