GSL::Interp.new(T, n)
GSL::Interp.alloc(T, n)
These methods create an interpolation object of type T for n data-points.
The library provides six types, which are specifiled by an identifier of a constant or a string:
Interp::LINEAR or "linear"
Linear interpolation. This interpolation method does not require any additional memory.
Interp::POLYNOMIAL or "polynomial"
Polynomial interpolation. This method should only be used for interpolating small numbers of points because polynomial interpolation introduces large oscillations, even for well-behaved datasets. The number of terms in the interpolating polynomial is equal to the number of points.
Interp::CSPLINE or "cspline"
Cubic spline with natural boundary conditions.
Interp::CSPLINE_PERIODIC or "gsl_cspline_periodic" or "cspline_periodic"
Cubic spline with periodic boundary conditions
Interp::AKIMA or "akima"
Non-rounded Akima spline with natural boundary conditions. This method uses the non-rounded corner algorithm of Wodicka.
Interp::AKIMA_PERIODIC or "akima_periodic"
Non-rounded Akima spline with periodic boundary conditions. This method uses the non-rounded corner algorithm of Wodicka.
ex) For cubic spline for 10 points,
sp = Interp.new("cspline", 10)
GSL::Interp.bsearch(xa, x, index_lo, index_hi)
xa[i] <= x < x[i+1]
. The index is searched for in the range
[index_lo,index_hi].GSL::Interp#init(xa, ya)
GSL::Interp
) does not save the data
vectors xa, ya and only stores the static state computed from the data.
The xa vector is always assumed to be strictly ordered; the behavior
for other arrangements is not defined.GSL::Interp#name
GSL::Interp#min_size
GSL::Interp#accel
In C level, the library requires the gsl_interp_accel
struct, but it is
hidden in Ruby/GSL. This method is used to access the Interp::Accel
object
stored in self.
The GSL function gsl_interp_accel_find
is defined as the method of the
Interp::Accel
class.
GSL::Interp::Accel#find(xa, x)
i
such that
xa[i] <= x < xa[i+1]
.GSL::Interp#eval(xa, ya, x)
GSL::Interp#eval_e(xa, ya, x)
GSL::Interp#eval_deriv(xa, ya, x)
GSL::Interp#eval_deriv_e(xa, ya, x)
GSL::Interp#eval_deriv2(xa, ya, x)
GSL::Interp#eval_deriv2_e(xa, ya, x)
GSL::Interp#eval_integ(xa, ya, a, b)
GSL::Interp#eval_integ_e(xa, ya, a, b)
GSL::Spline.new(T, n)
GSL::Spline
object of type T for n data-points.
The type T is the same as GSL::Interp
class.GSL::Spline#init(xa, ya)
GSL::Spline#eval(x)
This returns the interpolated value for a given point x.
NOTE: In GSL program in C, a gsl_interp_accel object is required for this computation. In Ruby/GSL, the gsl_interp_accel objects are hidden, they are automatically allocated when a GSL::Spline object is created, and also destroyed when the GSL::Spline object is cleaned by Ruby GC.
GSL::Spline#eval_deriv(x)
GSL::Spline#eval_deriv2(x)
GSL::Spline#eval_integ(a, b)
See also the GSL manual and the examples in samples/