[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-gsl] cspline: variable number of points
From: |
Greg Vesper |
Subject: |
[Help-gsl] cspline: variable number of points |
Date: |
Tue, 13 Dec 2011 14:59:05 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc11 Thunderbird/3.0.4 |
Hello,
The following snippet doesn't work, yelling at me that gsl_spline_alloc
and gsl_spline_init have been passed different lengths.
As far as I can tell from the code, it's impossible to do this. (I'm
only interested in the case of newnbins<nbins).
A) Can anyone tell me if I'm correct in this or provide a way to
accomplish this without freeing and re'alloc?
B) Would there be something wrong with writing it in this manner so long
as an error is returned from gsl_spline_init if newnbins > nbins?
{
int nbins = 100;
gsl_spline *vmax_spl;
gsl_interp_accel *vmax_spa;
vmax_spa = gsl_interp_accel_alloc();
vmax_spl = gsl_spline_alloc( gsl_interp_cspline, nbins );
int newnbins = 50
gsl_spline_init( vmax_spl, &lrvals[0], &vvals[0], newnbins );
...
gsl_spline_free(vmax_spl);
gsl_interp_accel_free(vmax_spa);
}