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

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).