18 namespace interpolation {
60 if ( yp1 > 0.99e30 ) {
65 u[1]=(3.0/(x[2]-x[1]))*((y[2]-y[1])/(x[2]-x[1])-yp1);
71 for (
int i=2; i<=n-1; i++ ) {
72 Real sig=(x[i]-x[i-1])/(x[i+1]-x[i-1]);
73 Real p=sig*y2[i-1]+2.0;
75 u[i]=(y[i+1]-y[i])/(x[i+1]-x[i]) - (y[i]-y[i-1])/(x[i]-x[i-1]);
76 u[i]=(6.0*u[i]/(x[i+1]-x[i-1])-sig*u[i-1])/
p;
81 if ( ypn > 0.99e30 ) {
85 un=(3.0/(x[n]-x[n-1]))*(ypn-(y[n]-y[n-1])/(x[n]-x[n-1]));
89 y2[n]=(un-qn*u[n-1])/(qn*y2[n-1]+1.0);
91 for (
int k=n-1; k>=1; k-- ) {
93 y2[k]=y2[k]*y2[k+1]+u[k];
123 while ( khi-klo > 1 ) {
124 int k=(khi+klo) >> 1;
139 y = a*ya[klo]+b*ya[khi] + ( (a*a*a-
a)*y2a[klo] + (b*b*b-b)*y2a[khi] ) *(h*h)/6.0;
140 dy = (ya[khi]-ya[klo])/h + ( (3*b*b-1)*y2a[khi] - (3*a*a-1)*y2a[klo] ) * h /6.0;
utility::vector1< Real > spline_second_derivative(utility::vector1< Real > const &x, utility::vector1< Real > const &y, Real yp1, Real ypn)
void spline_interpolate(utility::vector1< Real > const &xa, utility::vector1< Real > const &ya, utility::vector1< Real > const &y2a, Real x, Real &y, Real &dy)