CubicSpline Class Reference

A 1-dimensional ($\mathbf{R}^{1} \rightarrow \mathbf{R}^{1}$) cubic spline interpolation. More...

#include <CubicSpline.h>

Inheritance diagram for CubicSpline:

FunctionR1toR1 CubicSplineWithGeometricProgressionGrid

List of all members.

Public Member Functions

 CubicSpline ()
 Creates an instance of this class.
void operator= (const CubicSpline &rhs)
 Sets two CubicSpline objects equal.
void initializeWithFunctionValues (const Array1D< double > &xInput, const Array1D< double > &yInput, double yPrimeFirst, double yPrimeLast)
 Initializes the spline with the function values at given points plus the derivative values at the end points.
void initializeWithDerivativeValues (const Array1D< double > &xInput, const Array1D< double > &yPrimeInput, double yFirst)
 Initializes the spline with the derivative values at given points plus the function value at the first point.
void evaluate (double x)
 Evaluates the function at $x$.
double getFunctionValue ()
 Gets the function value at the last evaluated point.
double getFirstDerivativeValue ()
 Gets the function's first deriviate at the last evaluated point.
double getSecondDerivativeValue ()
 Gets the function's second deriviative at the last evaluated point.
double integrate (int indexStart, int indexStop)
 This function will integrate the spline between two indices.
void toXML (ostream &strm)
 Writes the state of this object to an XML stream.
double Brent_fmin (double ax, double bx, double tol)
double function (double x)
double minimum (double left, double right)

Protected Member Functions

void evaluate (double x, int index)
 Evaluate the function at $x$ when the index of the box of the domain containing $x$ is known.

Private Member Functions

void solve_tridiagonal_system ()
void solve_tridiagonal_system2 ()

Private Attributes

Array1D< double > x_list
Array1D< double > y_list
Array1D< double > yp_list
Array1D< double > a0_list
Array1D< double > a1_list
Array1D< double > a2_list
Array1D< double > a3_list
Array1D< double > row_right
Array1D< double > row_middle
Array1D< double > row_left
Array1D< double > col_rhs
double y0
double yp0
double ypend
int n
double f
double dfdx
double ddfddx

Friends

ostream & operator<< (ostream &strm, CubicSpline &rhs)
 Writes the state of this object to an XML stream.


Detailed Description

A 1-dimensional ($\mathbf{R}^{1} \rightarrow \mathbf{R}^{1}$) cubic spline interpolation.

Definition at line 30 of file CubicSpline.h.


Constructor & Destructor Documentation

CubicSpline::CubicSpline (  ) 

Creates an instance of this class.

Definition at line 15 of file CubicSpline.cpp.


Member Function Documentation

void CubicSpline::operator= ( const CubicSpline rhs  ) 

Sets two CubicSpline objects equal.

Parameters:
rhs object to set this object equal to

Definition at line 18 of file CubicSpline.cpp.

References a0_list, a1_list, a2_list, a3_list, ddfddx, dfdx, f, n, x_list, y_list, yp0, yp_list, and ypend.

Referenced by CubicSplineWithGeometricProgressionGrid::operator=().

void CubicSpline::initializeWithFunctionValues ( const Array1D< double > &  xInput,
const Array1D< double > &  yInput,
double  yPrimeFirst,
double  yPrimeLast 
)

Initializes the spline with the function values at given points plus the derivative values at the end points.

Parameters:
xInput x values of the given points.
yInput y values of the given points.
yPrimeFirst derivative value at the first point.
yPrimeLast derivative value at the last point.

Definition at line 37 of file CubicSpline.cpp.

References a0_list, a1_list, a2_list, a3_list, Array1D< T >::allocate(), col_rhs, Array1D< T >::dim1(), n, row_left, row_middle, row_right, solve_tridiagonal_system(), x_list, y_list, yp0, yp_list, and ypend.

Referenced by QMCNuclearForces::calcCoefficients(), QMCEigenSearch::get_a_diag(), QMCNuclearForces::initialize(), and QMCBasisFunction::initializeInterpolation().

void CubicSpline::initializeWithDerivativeValues ( const Array1D< double > &  xInput,
const Array1D< double > &  yPrimeInput,
double  yFirst 
)

Initializes the spline with the derivative values at given points plus the function value at the first point.

Parameters:
xInput x values of the given points.
yPrimeInput derivative values of the given points.
yFirst function value at the first point.

Definition at line 159 of file CubicSpline.cpp.

References a0_list, a1_list, a2_list, a3_list, Array1D< T >::allocate(), col_rhs, Array1D< T >::dim1(), n, row_left, row_middle, row_right, solve_tridiagonal_system2(), x_list, y0, y_list, and yp_list.

void CubicSpline::evaluate ( double  x  )  [virtual]

Evaluates the function at $x$.

Parameters:
x point to evaluate the function.

Implements FunctionR1toR1.

Reimplemented in CubicSplineWithGeometricProgressionGrid.

Definition at line 363 of file CubicSpline.cpp.

References n, and x_list.

Referenced by CubicSplineWithGeometricProgressionGrid::evaluate(), and QMCNuclearForces::initialize().

double CubicSpline::getFunctionValue (  )  [virtual]

Gets the function value at the last evaluated point.

Returns:
function value.

Implements FunctionR1toR1.

Definition at line 454 of file CubicSpline.cpp.

References f.

Referenced by QMCNuclearForces::initialize().

double CubicSpline::getFirstDerivativeValue (  )  [virtual]

Gets the function's first deriviate at the last evaluated point.

Returns:
function's deriviative value.

Implements FunctionR1toR1.

Definition at line 459 of file CubicSpline.cpp.

References dfdx.

double CubicSpline::getSecondDerivativeValue (  )  [virtual]

Gets the function's second deriviative at the last evaluated point.

Returns:
function's second derivative value.

Implements FunctionR1toR1.

Definition at line 464 of file CubicSpline.cpp.

References ddfddx.

double CubicSpline::integrate ( int  indexStart,
int  indexStop 
)

This function will integrate the spline between two indices.

Parameters:
indexStart 
indexStop 

Definition at line 392 of file CubicSpline.cpp.

References a0, a0_list, a1_list, a2_list, a3_list, n, and x_list.

Referenced by QMCNuclearForces::calcCoefficients(), and QMCNuclearForces::initialize().

void CubicSpline::toXML ( ostream &  strm  ) 

Writes the state of this object to an XML stream.

Parameters:
strm XML stream

Definition at line 469 of file CubicSpline.cpp.

References a0_list, a1_list, a2_list, a3_list, ddfddx, dfdx, Array1D< T >::dim1(), f, x_list, y_list, and yp_list.

Referenced by operator<<().

void CubicSpline::evaluate ( double  x,
int  index 
) [protected]

Evaluate the function at $x$ when the index of the box of the domain containing $x$ is known.

Parameters:
x point to evaluate the function.
index index of the box of the domain containing x.

Definition at line 424 of file CubicSpline.cpp.

References a0, a0_list, a1_list, a2_list, a3_list, ddfddx, dfdx, f, n, and x_list.

void CubicSpline::solve_tridiagonal_system (  )  [private]

Definition at line 278 of file CubicSpline.cpp.

References col_rhs, n, row_left, row_middle, and row_right.

Referenced by initializeWithFunctionValues().

void CubicSpline::solve_tridiagonal_system2 (  )  [private]

Definition at line 316 of file CubicSpline.cpp.

References col_rhs, f, n, row_left, row_middle, and row_right.

Referenced by initializeWithDerivativeValues().

double FunctionR1toR1::Brent_fmin ( double  ax,
double  bx,
double  tol 
) [inherited]

Definition at line 81 of file FunctionR1toR1.cpp.

References FunctionR1toR1::function().

Referenced by FunctionR1toR1::minimum().

double FunctionR1toR1::function ( double  x  )  [inherited]

double FunctionR1toR1::minimum ( double  left,
double  right 
) [inherited]

Definition at line 215 of file FunctionR1toR1.cpp.

References FunctionR1toR1::Brent_fmin().

Referenced by QMCEigenSearch::get_a_diag().


Friends And Related Function Documentation

ostream& operator<< ( ostream &  strm,
CubicSpline rhs 
) [friend]

Writes the state of this object to an XML stream.

Definition at line 527 of file CubicSpline.cpp.


Member Data Documentation

Array1D<double> CubicSpline::x_list [private]

Array1D<double> CubicSpline::y_list [private]

Array1D<double> CubicSpline::yp_list [private]

Array1D<double> CubicSpline::a0_list [private]

Array1D<double> CubicSpline::a1_list [private]

Array1D<double> CubicSpline::a2_list [private]

Array1D<double> CubicSpline::a3_list [private]

Array1D<double> CubicSpline::row_right [private]

Array1D<double> CubicSpline::row_middle [private]

Array1D<double> CubicSpline::row_left [private]

Array1D<double> CubicSpline::col_rhs [private]

double CubicSpline::y0 [private]

Definition at line 130 of file CubicSpline.h.

Referenced by initializeWithDerivativeValues().

double CubicSpline::yp0 [private]

Definition at line 131 of file CubicSpline.h.

Referenced by initializeWithFunctionValues(), and operator=().

double CubicSpline::ypend [private]

Definition at line 132 of file CubicSpline.h.

Referenced by initializeWithFunctionValues(), and operator=().

int CubicSpline::n [private]

double CubicSpline::f [private]

double CubicSpline::dfdx [private]

Definition at line 136 of file CubicSpline.h.

Referenced by evaluate(), getFirstDerivativeValue(), operator=(), and toXML().

double CubicSpline::ddfddx [private]

Definition at line 137 of file CubicSpline.h.

Referenced by evaluate(), getSecondDerivativeValue(), operator=(), and toXML().


The documentation for this class was generated from the following files:

Generated on Sat Jul 5 16:14:01 2008 for QMcBeaver by  doxygen 1.5.6