![]() |
QMCPACK
|
The CubicSplineCommon class is a third-order spline representation of a function. More...
Public Member Functions | |
Array< double, 1 > & | Data () |
int | size () |
Returns the interpolated value. More... | |
double | operator() (double x) |
double | Deriv (double x) |
Returns the interpolated first derivative. More... | |
double | Deriv2 (double x) |
Returns the interpolated second derivative. More... | |
double | Deriv3 (double x) |
Returns the interpolated third derivative. More... | |
void | Update () |
Recompute the second derivatives from the function values. More... | |
void | Init (std::shared_ptr< Grid > &NewGrid, Array< double, 1 > NewYs, double startderiv, double endderiv) |
Initialize the cubic spline. More... | |
void | Init (std::shared_ptr< Grid > &NewGrid, Array< double, 1 > NewYs) |
Simplified form which assumes that the second derivative at both boundaries are zero. More... | |
CubicSplineCommon (std::shared_ptr< Grid > &NewGrid, Array< double, 1 > NewYs) | |
Simplified constructor. More... | |
CubicSplineCommon (std::shared_ptr< Grid > &NewGrid, Array< double, 1 > NewYs, double startderiv, double endderiv) | |
Full constructor. More... | |
double | operator() (int i) const |
Returns the value of the function at the ith grid point. More... | |
double & | operator() (int i) |
Returns a reference to the value at the ith grid point. More... | |
double | Params (int i) const |
Returns the value of the function at the ith grid point. More... | |
double & | Params (int i) |
Returns a reference to the value at the ith grid point. More... | |
void | Write (IOSectionClass &outSection) |
void | Read (IOSectionClass &inSection) |
CubicSplineCommon & | operator= (const CubicSplineCommon &spline) |
CubicSplineCommon () | |
Trivial constructor. More... | |
Public Attributes | |
int | NumParams |
std::shared_ptr< Grid > | grid |
double | StartDeriv |
The values of the derivative of the represented function on the boundary. More... | |
double | EndDeriv |
Private Attributes | |
int | UpToDate |
This flag records whether or not the stored second derivatives are in sync with the function values. More... | |
Array< double, 1 > | y |
The function values on the grid points. More... | |
Array< double, 1 > | d2y |
The second derivatives of the function. More... | |
The CubicSplineCommon class is a third-order spline representation of a function.
It stores a pointer to a grid and the values of the function and its second derivative at the points defined by the grid.
Definition at line 28 of file CubicSplineCommon.h.
|
inline |
Simplified constructor.
Definition at line 88 of file CubicSplineCommon.h.
References EndDeriv, Init(), and StartDeriv.
|
inline |
Full constructor.
Definition at line 95 of file CubicSplineCommon.h.
References Init(), and Update().
|
inline |
Trivial constructor.
Definition at line 140 of file CubicSplineCommon.h.
References EndDeriv, grid, NumParams, StartDeriv, and UpToDate.
|
inline |
Definition at line 151 of file CubicSplineCommon.h.
|
inline |
Returns the interpolated first derivative.
Definition at line 200 of file CubicSplineCommon.h.
References d2y, grid, Grid::NumPoints, Grid::ReverseMap(), Update(), UpToDate, and y.
|
inline |
Returns the interpolated second derivative.
Definition at line 228 of file CubicSplineCommon.h.
References d2y, grid, Grid::NumPoints, Grid::ReverseMap(), Update(), and UpToDate.
|
inline |
Returns the interpolated third derivative.
Definition at line 255 of file CubicSplineCommon.h.
References d2y, grid, Grid::NumPoints, Grid::ReverseMap(), Update(), and UpToDate.
|
inline |
Initialize the cubic spline.
See notes about start and end deriv above.
Definition at line 64 of file CubicSplineCommon.h.
References d2y, EndDeriv, grid, NumParams, Array< T, D, ALLOC >::resize(), Array< T, D, ALLOC >::rows(), StartDeriv, Update(), and y.
Referenced by CubicSplineCommon().
Simplified form which assumes that the second derivative at both boundaries are zero.
Definition at line 85 of file CubicSplineCommon.h.
References Init().
Referenced by Init().
|
inline |
Definition at line 158 of file CubicSplineCommon.h.
References d2y, Grid::End, grid, Grid::NumPoints, Grid::ReverseMap(), Update(), UpToDate, and y.
|
inline |
Returns the value of the function at the ith grid point.
Definition at line 102 of file CubicSplineCommon.h.
References y.
|
inline |
Returns a reference to the value at the ith grid point.
Definition at line 104 of file CubicSplineCommon.h.
CubicSplineCommon& operator= | ( | const CubicSplineCommon & | spline | ) |
|
inline |
Returns the value of the function at the ith grid point.
Definition at line 111 of file CubicSplineCommon.h.
References y.
|
inline |
Returns a reference to the value at the ith grid point.
Definition at line 113 of file CubicSplineCommon.h.
References y.
|
inline |
Definition at line 124 of file CubicSplineCommon.h.
References IOSectionClass::CloseSection(), d2y, EndDeriv, grid, NumParams, IOSectionClass::OpenSection(), ReadGrid(), IOSectionClass::ReadVar(), Array< T, D, ALLOC >::resize(), Array< T, D, ALLOC >::size(), StartDeriv, Update(), and y.
|
inline |
void Update | ( | ) |
Recompute the second derivatives from the function values.
Referenced by CubicSplineCommon(), Deriv(), Deriv2(), Deriv3(), Init(), operator()(), and Read().
|
inline |
Definition at line 114 of file CubicSplineCommon.h.
References IOSectionClass::CloseSection(), EndDeriv, grid, IOSectionClass::NewSection(), StartDeriv, IOSectionClass::WriteVar(), and y.
|
private |
The second derivatives of the function.
Definition at line 38 of file CubicSplineCommon.h.
Referenced by Deriv(), Deriv2(), Deriv3(), Init(), operator()(), and Read().
double EndDeriv |
Definition at line 47 of file CubicSplineCommon.h.
Referenced by CubicSplineCommon(), Init(), Read(), and Write().
std::shared_ptr<Grid> grid |
Definition at line 42 of file CubicSplineCommon.h.
Referenced by CubicSplineCommon(), Deriv(), Deriv2(), Deriv3(), Init(), operator()(), Read(), size(), and Write().
int NumParams |
Definition at line 41 of file CubicSplineCommon.h.
Referenced by CubicSplineCommon(), Init(), and Read().
double StartDeriv |
The values of the derivative of the represented function on the boundary.
If each value is greater that 1e30, we compute boundary conditions assuming that the second derivative is zero at that boundary.
Definition at line 47 of file CubicSplineCommon.h.
Referenced by CubicSplineCommon(), Init(), Read(), and Write().
|
private |
This flag records whether or not the stored second derivatives are in sync with the function values.
It is used to determine whether the second derivatives need recomputation.
Definition at line 34 of file CubicSplineCommon.h.
Referenced by CubicSplineCommon(), Data(), Deriv(), Deriv2(), Deriv3(), and operator()().
|
private |
The function values on the grid points.
Definition at line 36 of file CubicSplineCommon.h.
Referenced by Data(), Deriv(), Init(), operator()(), Params(), Read(), and Write().