13 const dvector& _y,
double yp1,
double ypn) :
x(_x) , y(_y)
30 for (
int i=mmin;i<=mmax;i++)
47 cerr <<
" Incompatible bounds in input to spline" <<
endl;
62 u[1]=(3.0/(x[2]-x[1]))*((y[2]-y[1])/(x[2]-x[1])-yp1);
66 sig=(x[i]-x[i-1])/(x[i+1]-x[i-1]);
69 u[i]=(y[i+1]-y[i])/(x[i+1]-x[i]) - (y[i]-y[i-1])/(x[i]-x[i-1]);
70 u[i]=(6.0*u[i]/(x[i+1]-x[i-1])-sig*u[i-1])/p;
79 un=(3.0/(x[n]-x[n-1]))*(ypn-(y[n]-y[n-1])/(x[n]-x[n-1]));
81 y2[n]=(un-qn*u[n-1])/(qn*y2[n-1]+1.0);
84 y2[k]=y2[k]*y2[k+1]+u[k];
112 if (xa[k] > x) khi=k;
118 y=a*ya[klo]+b*ya[khi]+((a*a*a-a)*y2a[klo]+(b*b*b-b)*y2a[khi])*(h*h)/6.0;
double operator()(double u)
Vector of double precision numbers.
int indexmin() const
Get minimum valid index.
void allocate(int ncl, int ncu)
Allocate memory for a dvector.
cubic_spline_function(const dvector &_x, const dvector &_y, double yp1=0.0, double ypn=0.0)
double splint(const dvector &xa, const dvector &ya, const dvector &y2a, double x)
prnstream & endl(prnstream &)
int indexmax() const
Get maximum valid index.
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
dvector spline(const dvector &x, const dvector &y, double yp1, double ypn)
dvector & shift(int min)
Shift valid range of subscripts.