Given the arrays xa(1:n)
and ya(1:n)
of length n
, which tabulate a
function (with the xai's in order), and given the array y2a(1:n)
, which
is the output from spline above, and given a value of x
, this routine
returns a cubic-spline interpolated value y
and the derivative yderiv
.
We will nd the right place in the table by means of bisection.
This is optimal if sequential calls to this routine are at random
values of x
. If sequential calls are in order, and closely
spaced, one would do better to store previous values of
klo
and khi
and test if they remain appropriate on the next call.
Note
Taken from "Numerical Recipes in Fortran 77", W.H.Press et al.
T h i s
r o u t i n e
r e t u r n s
a
c u b i c - s p l i n e
i n t e r p o l a t e d
v a l u e
y
a n d
t h e
d e r i v a t i v e
y
d
e
r
i
v
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=dp), | dimension(*) | :: | xa | |||
real(kind=dp), | dimension(*) | :: | ya | |||
real(kind=dp), | dimension(*) | :: | y2a | |||
integer | :: | n | ||||
real(kind=dp) | :: | x | ||||
real(kind=dp) | :: | y | ||||
real(kind=dp) | :: | yderiv |
T h i s
r o u t i n e
r e t u r n s
a
c u b i c - s p l i n e
i n t e r p o l a t e d
v a l u e
y
a n d
t h e
d e r i v a t i v e
y
d
e
r
i
v
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=dp), | dimension(*) | :: | xa | |||
complex(kind=dp), | dimension(*) | :: | ya | |||
complex(kind=dp), | dimension(*) | :: | y2a | |||
integer | :: | n | ||||
real(kind=dp) | :: | x | ||||
complex(kind=dp) | :: | y | ||||
complex(kind=dp) | :: | yderiv |