Adding basic documentation to some module not yet implemented. Also added some functions.
[Math-GSL.git] / Interp.i
blobc95830302531f94dbe77a31d3f8dd3d8fcce0f1c
1 %module "Math::GSL::Interp"
3 %include "typemaps.i"
4 %include "gsl_typemaps.i"
6 %apply double *OUTPUT { double * y, double * d, double * d2, double * result };
8 %{
9 #include "gsl/gsl_types.h"
10 #include "gsl/gsl_interp.h"
12 %include "gsl/gsl_types.h"
13 %include "gsl/gsl_interp.h"
16 %perlcode %{
17 @EXPORT_OK = qw/
18 gsl_interp_accel_alloc
19 gsl_interp_accel_find
20 gsl_interp_accel_reset
21 gsl_interp_accel_free
22 gsl_interp_alloc
23 gsl_interp_init
24 gsl_interp_name
25 gsl_interp_min_size
26 gsl_interp_eval_e
27 gsl_interp_eval
28 gsl_interp_eval_deriv_e
29 gsl_interp_eval_deriv
30 gsl_interp_eval_deriv2_e
31 gsl_interp_eval_deriv2
32 gsl_interp_eval_integ_e
33 gsl_interp_eval_integ
34 gsl_interp_free
35 gsl_interp_bsearch
36 $gsl_interp_linear
37 $gsl_interp_polynomial
38 $gsl_interp_cspline
39 $gsl_interp_cspline_periodic
40 $gsl_interp_akima
41 $gsl_interp_akima_periodic
43 %EXPORT_TAGS = ( all => [ @EXPORT_OK ] );
45 __END__
47 =head1 NAME
49 Math::GSL::Interp - Functions for performing interpolation
51 =head1 SYNOPSIS
53 use Math::GSL::Interp qw/:all/;
55 =head1 DESCRIPTION
57 Here is a list of all the functions included in this module :
59 =over 1
61 =item C<gsl_interp_accel_alloc()> - This function returns a pointer to an accelerator object, which is a kind of iterator for interpolation lookups. It tracks the state of lookups, thus allowing for application of various acceleration strategies.
63 =item C<gsl_interp_accel_find($a, $x_array, $size, $x)> - This function performs a lookup action on the data array $x_array of size $size, using the given accelerator $a. This is how lookups are performed during evaluation of an interpolation. The function returns an index i such that $x_array[i] <= $x < $x_array[i+1].
65 =item C<gsl_interp_accel_reset>
67 =item C<gsl_interp_accel_free($a)> - This function frees the accelerator object $a.
69 =item C<gsl_interp_alloc($T, $alloc)> - This function returns a newly allocated interpolation object of type $T for $size data-points. $T must be one of the constants below.
71 =item C<gsl_interp_init($interp, $xa, $ya, $size)> - This function initializes the interpolation object interp for the data (xa,ya) where xa and ya are arrays of size size. The interpolation object (gsl_interp) does not save the data arrays xa and ya and only stores the static state computed from the data. The xa data array is always assumed to be strictly ordered, with increasing x values; the behavior for other arrangements is not defined.
73 =item C<gsl_interp_name($interp)> - This function returns the name of the interpolation type used by $interp.
75 =item C<gsl_interp_min_size($interp)> - This function returns the minimum number of points required by the interpolation type of $interp. For example, Akima spline interpolation requires a minimum of 5 points.
77 =item C<gsl_interp_eval_e($interp, $xa, $ya, $x, $acc)> - This functions returns the interpolated value of y for a given point $x, using the interpolation object $interp, data arrays $xa and $ya and the accelerator $acc. The function returns 0 if the operation succeeded, 1 otherwise and the y value.
79 =item C<gsl_interp_eval($interp, $xa, $ya, $x, $acc)> - This functions returns the interpolated value of y for a given point $x, using the interpolation object $interp, data arrays $xa and $ya and the accelerator $acc.
81 =item C<gsl_interp_eval_deriv_e($interp, $xa, $ya, $x, $acc)> - This function computes the derivative value of y for a given point $x, using the interpolation object $interp, data arrays $xa and $ya and the accelerator $acc. The function returns 0 if the operation succeeded, 1 otherwise and the d value.
83 =item C<gsl_interp_eval_deriv($interp, $xa, $ya, $x, $acc)> - This function returns the derivative d of an interpolated function for a given point $x, using the interpolation object interp, data arrays $xa and $ya and the accelerator $acc.
85 =item C<gsl_interp_eval_deriv2_e($interp, $xa, $ya, $x, $acc)> - This function computes the second derivative d2 of an interpolated function for a given point $x, using the interpolation object $interp, data arrays $xa and $ya and the accelerator $acc. The function returns 0 if the operation succeeded, 1 otherwise and the d2 value.
87 =item C<gsl_interp_eval_deriv2($interp, $xa, $ya, $x, $acc)> - This function returns the second derivative d2 of an interpolated function for a given point $x, using the interpolation object $interp, data arrays $xa and $ya and the accelerator $acc.
89 =item C<gsl_interp_eval_integ_e($interp, $xa, $ya, $a, $b, $acc)> - This function computes the numerical integral result of an interpolated function over the range [$a, $b], using the interpolation object $interp, data arrays $xa and $ya and the accelerator $acc. The function returns 0 if the operation succeeded, 1 otherwise and the result value.
91 =item C<gsl_interp_eval_integ($interp, $xa, $ya, $a, $b, $acc)> - This function returns the numerical integral result of an interpolated function over the range [$a, $b], using the interpolation object $interp, data arrays $xa and $ya and the accelerator $acc.
93 =item C<gsl_interp_free($interp)> - This function frees the interpolation object $interp.
95 =item C<gsl_interp_bsearch($x_array, $x, $index_lo, $index_hi)> - This function returns the index i of the array $x_array such that $x_array[i] <= x < $x_array[i+1]. The index is searched for in the range [$index_lo,$index_hi].
97 =back
99 This module also includes the following constants :
101 =over 1
103 =item C<$gsl_interp_linear> - Linear interpolation
105 =item C<$gsl_interp_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.
107 =item C<$gsl_interp_cspline> - Cubic spline with natural boundary conditions. The resulting curve is piecewise cubic on each interval, with matching first and second derivatives at the supplied data-points. The second derivative is chosen to be zero at the first point and last point.
109 =item C<$gsl_interp_cspline_periodic> - Cubic spline with periodic boundary conditions. The resulting curve is piecewise cubic on each interval, with matching first and second derivatives at the supplied data-points. The derivatives at the first and last points are also matched. Note that the last point in the data must have the same y-value as the first point, otherwise the resulting periodic interpolation will have a discontinuity at the boundary.
111 =item C<$gsl_interp_akima> - Non-rounded Akima spline with natural boundary conditions. This method uses the non-rounded corner algorithm of Wodicka.
113 =item C<$gsl_interp_akima_periodic> - Non-rounded Akima spline with periodic boundary conditions. This method uses the non-rounded corner algorithm of Wodicka.
115 =back
117 =head1 AUTHORS
119 Jonathan Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>
121 =head1 COPYRIGHT AND LICENSE
123 Copyright (C) 2008 Jonathan Leto and Thierry Moisan
125 This program is free software; you can redistribute it and/or modify it
126 under the same terms as Perl itself.
128 =cut