public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* gsl_cspline_init bug?
@ 2002-11-05 23:11 R. Sean Bowman
  2002-11-06  7:36 ` Kenneth Geisshirt
  2002-11-06 16:05 ` Gerard Jungman
  0 siblings, 2 replies; 3+ messages in thread
From: R. Sean Bowman @ 2002-11-05 23:11 UTC (permalink / raw)
  To: gsl-discuss

[-- Attachment #1: Type: TEXT/PLAIN, Size: 529 bytes --]

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


[-- Attachment #2: Type: TEXT/PLAIN, Size: 577 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gsl_cspline_init bug?
  2002-11-05 23:11 gsl_cspline_init bug? R. Sean Bowman
@ 2002-11-06  7:36 ` Kenneth Geisshirt
  2002-11-06 16:05 ` Gerard Jungman
  1 sibling, 0 replies; 3+ messages in thread
From: Kenneth Geisshirt @ 2002-11-06  7:36 UTC (permalink / raw)
  To: gsl-discuss

On Tue, 5 Nov 2002, R. Sean Bowman wrote:

> gsl: view_source.c:28: ERROR: vector length n must be positive integer
> Default GSL error handler invoked.
> Aborted

I can reproduce the error message. But if I set PTS to 10 (as the example
in the manual), the problem disappears.

> Isn't this a problem?  Shouldn't csplines need more than two points to do
> interpolation?

Yes, and maybe we should validate the input parameters :-).

Kneth

-- 
Kenneth Geisshirt, M.Sc., Ph.D.         http://kenneth.geisshirt.dk
Grøndals Parkvej 2A, 3. sal                    kenneth@geisshirt.dk
DK-2720 Vanløse                                     +45 38 87 78 38

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gsl_cspline_init bug?
  2002-11-05 23:11 gsl_cspline_init bug? R. Sean Bowman
  2002-11-06  7:36 ` Kenneth Geisshirt
@ 2002-11-06 16:05 ` Gerard Jungman
  1 sibling, 0 replies; 3+ messages in thread
From: Gerard Jungman @ 2002-11-06 16:05 UTC (permalink / raw)
  To: R. Sean Bowman; +Cc: gsl-discuss

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-11-06 21:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-05 23:11 gsl_cspline_init bug? R. Sean Bowman
2002-11-06  7:36 ` Kenneth Geisshirt
2002-11-06 16:05 ` Gerard Jungman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).