init
Signature: (double x(n); double y(n); gsl_spline *spl)
The init method initializes a new instance of INTERP. It needs as input an interpolation type and two
ndarrays holding the x and y values to be interpolated. The GSL routines require that x be monotonically
increasing and a quicksort is performed by default to ensure that. You can skip the quicksort by passing
the option {Sort => 0}.
The available interpolation types are :
linear
polynomial
cspline (natural cubic spline)
cspline_periodic (periodic cubic spline)
akima (natural akima spline)
akima_periodic (periodic akima spline)
Please check the GSL documentation for more information.
Usage:
$blessed_ref = PDL::GSL::INTERP->init($interp_method,$x,$y,$opt);
Example:
$x = sequence(10);
$y = exp($x);
$spl = PDL::GSL::INTERP->init('cspline',$x,$y)
$spl = PDL::GSL::INTERP->init('cspline',$x,$y,{Sort => 1}) #same as above
# no sorting done on x, user is certain that x is monotonically increasing
$spl = PDL::GSL::INTERP->init('cspline',$x,$y,{Sort => 0});
init does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is
set for any of the input ndarrays.
eval
Signature: (double x(); double [o] out(); gsl_spline *spl;gsl_interp_accel *acc)
The function eval returns the interpolating function at a given point. It will barf with an "input
domain error" if you try to extrapolate.
Usage:
$result = $spl->eval($points);
Example:
my $res = $spl->eval($x)
eval processes bad values. It will set the bad-value flag of all output ndarrays if the flag is set for
any of the input ndarrays.
deriv
Signature: (double x(); double [o] out(); gsl_spline *spl;gsl_interp_accel *acc)
The deriv function returns the derivative of the interpolating function at a given point. It will barf
with an "input domain error" if you try to extrapolate.
Usage:
$result = $spl->deriv($points);
Example:
my $res = $spl->deriv($x)
deriv does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is
set for any of the input ndarrays.
deriv2
Signature: (double x(); double [o] out(); gsl_spline *spl;gsl_interp_accel *acc)
The deriv2 function returns the second derivative of the interpolating function at a given point. It
will barf with an "input domain error" if you try to extrapolate.
Usage:
$result = $spl->deriv2($points);
Example:
my $res = $spl->deriv2($x)
deriv2 does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is
set for any of the input ndarrays.
integ
Signature: (double a(); double b(); double [o] out(); gsl_spline *spl;gsl_interp_accel *acc)
The integ function returns the integral of the interpolating function between two points. It will barf
with an "input domain error" if you try to extrapolate.
Usage:
$result = $spl->integ($la,$lb);
Example:
my $res = $spl->integ($la,$lb)
integ does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is
set for any of the input ndarrays.