This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gsl_cspline_init bug?


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;
> }



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]