1INTERP(3)             User Contributed Perl Documentation            INTERP(3)
2
3
4

NAME

6       PDL::GSL::INTERP - PDL interface to Interpolation routines in GSL
7

DESCRIPTION

9       This is an interface to the interpolation package present in the GNU
10       Scientific Library.
11

SYNOPSIS

13          use PDL;
14          use PDL::GSL::INTERP;
15
16          my $x = sequence(10);
17          my $y = exp($x);
18
19          my $spl = PDL::GSL::INTERP->init('cspline',$x,$y);
20
21          my $res = $spl->eval(4.35);
22          $res = $spl->deriv(4.35);
23          $res = $spl->deriv2(4.35);
24          $res = $spl->integ(2.1,7.4);
25

NOMENCLATURE

27       Throughout this documentation we strive to use the same variables that
28       are present in the original GSL documentation (see See Also).
29       Oftentimes those variables are called "a" and "b". Since good Perl
30       coding practices discourage the use of Perl variables $a and $b, here
31       we refer to Parameters "a" and "b" as $pa and $pb, respectively, and
32       Limits (of domain or integration) as $la and $lb.  #line 63 "INTERP.pm"
33

FUNCTIONS

35   init
36         Signature: (double x(n); double y(n); gsl_spline *spl)
37
38       The init method initializes a new instance of INTERP. It needs as input
39       an interpolation type and two ndarrays holding the x and y values to be
40       interpolated. The GSL routines require that x be monotonically
41       increasing and a quicksort is performed by default to ensure that. You
42       can skip the quicksort by passing the option {Sort => 0}.
43
44       The available interpolation types are :
45
46       linear
47       polynomial
48       cspline (natural cubic spline)
49       cspline_periodic  (periodic cubic spline)
50       akima (natural akima spline)
51       akima_periodic  (periodic akima spline)
52
53       Please check the GSL documentation for more information.
54
55       Usage:
56
57           $blessed_ref = PDL::GSL::INTERP->init($interp_method,$x,$y,$opt);
58
59       Example:
60
61           $x = sequence(10);
62           $y = exp($x);
63
64           $spl = PDL::GSL::INTERP->init('cspline',$x,$y)
65           $spl = PDL::GSL::INTERP->init('cspline',$x,$y,{Sort => 1}) #same as above
66
67           # no sorting done on x, user is certain that x is monotonically increasing
68           $spl = PDL::GSL::INTERP->init('cspline',$x,$y,{Sort => 0});
69
70       init does not process bad values.  It will set the bad-value flag of
71       all output ndarrays if the flag is set for any of the input ndarrays.
72
73   eval
74         Signature: (double x(); double [o] out(); gsl_spline *spl;gsl_interp_accel *acc)
75
76       The function eval returns the interpolating function at a given point.
77       It will barf with an "input domain error" if you try to extrapolate.
78
79       Usage:
80
81           $result = $spl->eval($points);
82
83       Example:
84
85           my $res = $spl->eval($x)
86
87       eval processes bad values.  It will set the bad-value flag of all
88       output ndarrays if the flag is set for any of the input ndarrays.
89
90   deriv
91         Signature: (double x(); double [o] out(); gsl_spline *spl;gsl_interp_accel *acc)
92
93       The deriv function returns the derivative of the interpolating function
94       at a given point.  It will barf with an "input domain error" if you try
95       to extrapolate.
96
97       Usage:
98
99           $result = $spl->deriv($points);
100
101       Example:
102
103           my $res = $spl->deriv($x)
104
105       deriv does not process bad values.  It will set the bad-value flag of
106       all output ndarrays if the flag is set for any of the input ndarrays.
107
108   deriv2
109         Signature: (double x(); double [o] out(); gsl_spline *spl;gsl_interp_accel *acc)
110
111       The deriv2 function returns the second derivative of the interpolating
112       function at a given point.  It will barf with an "input domain error"
113       if you try to extrapolate.
114
115       Usage:
116
117           $result = $spl->deriv2($points);
118
119       Example:
120
121           my $res = $spl->deriv2($x)
122
123       deriv2 does not process bad values.  It will set the bad-value flag of
124       all output ndarrays if the flag is set for any of the input ndarrays.
125
126   integ
127         Signature: (double a(); double b(); double [o] out(); gsl_spline *spl;gsl_interp_accel *acc)
128
129       The integ function returns the integral of the interpolating function
130       between two points.  It will barf with an "input domain error" if you
131       try to extrapolate.
132
133       Usage:
134
135           $result = $spl->integ($la,$lb);
136
137       Example:
138
139           my $res = $spl->integ($la,$lb)
140
141       integ does not process bad values.  It will set the bad-value flag of
142       all output ndarrays if the flag is set for any of the input ndarrays.
143

BUGS

145       Feedback is welcome.
146

SEE ALSO

148       PDL
149
150       The GSL documentation for interpolation is online at
151       <https://www.gnu.org/software/gsl/doc/html/interp.html>
152

AUTHOR

154       This file copyright (C) 2003 Andres Jordan
155       <andresj@physics.rutgers.edu> All rights reserved. There is no
156       warranty. You are allowed to redistribute this software/documentation
157       under certain conditions. For details, see the file COPYING in the PDL
158       distribution. If this file is separated from the PDL distribution, the
159       copyright notice should be included in the file.
160
161       The GSL interpolation module was written by Gerard Jungman.
162
163
164
165perl v5.36.0                      2022-07-22                         INTERP(3)
Impressum