NR Namespace Reference


Functions

template<typename FunctionType, typename ScalarType>
ScalarType adaptsim (FunctionType &func, ScalarType a, ScalarType b, ScalarType tol, int &info)
template<typename FunctionType, typename ScalarType>
ScalarType adaptsimstp (FunctionType &func, ScalarType a, ScalarType b, ScalarType fa, ScalarType fm, ScalarType fb, ScalarType is, int &info)
void polint (const vector< double > &xa, const vector< double > &ya, const double x, double &y, double &dy)
template<typename FunctionType>
double trapzd (FunctionType &func, const double a, const double b, const int n)
template<typename FunctionType>
double qtrap (FunctionType &func, double a, double b, double tol, int &info)
template<typename FunctionType>
double qromb (FunctionType &func, double a, double b, double tol, int &info)
void spline (const vector< double > &x, const vector< double > &y, const double yp1, const double ypn, vector< double > &y2)
void splint (const vector< double > &xa, const vector< double > &ya, const vector< double > &y2a, const double x, double &y)
void spline (const std::vector< double > &x, const std::vector< double > &y, const double yp1, const double ypn, std::vector< double > &y2)
void splint (const std::vector< double > &xa, const std::vector< double > &ya, const std::vector< double > &y2a, const double x, double &y)


Function Documentation

template<typename FunctionType, typename ScalarType>
ScalarType NR::adaptsim ( FunctionType &  func,
ScalarType  a,
ScalarType  b,
ScalarType  tol,
int &  info 
)

function Q = adaptsim(f,a,b,tol,trace,varargin) ADAPTSIM Numerically evaluate integral using adaptive % Simpson rule. % % Q = ADAPTSIM('F',A,B) approximates the integral of % F(X) from A to B to machine precision. 'F' is a % string containing the name of the function. The % function F must return a vector of output values if % given a vector of input values. % % Q = ADAPTSIM('F',A,B,TOL) integrates to a relative % error of TOL. % % Q = ADAPTSIM('F',A,B,TOL,TRACE) displays the left % end point of the current interval, the interval % length, and the partial integral. % % Q = ADAPTSIM('F',A,B,TOL,TRACE,P1,P2,...) allows % coefficients P1, ... to be passed directly to the % function F: G = F(X,P1,P2,...). To use default values % for TOL or TRACE, one may pass the empty matrix ([]). % % See also ADAPTSIMSTP. % % Walter Gander, 08/03/98 % Reference: Gander, Computermathematik, Birkhaeuser, 1992.

Definition at line 48 of file adaptsim.h.

References adaptsimstp().

Referenced by eval_gap_voltage().

Here is the call graph for this function:

template<typename FunctionType, typename ScalarType>
ScalarType NR::adaptsimstp ( FunctionType &  func,
ScalarType  a,
ScalarType  b,
ScalarType  fa,
ScalarType  fm,
ScalarType  fb,
ScalarType  is,
int &  info 
)

ADAPTSIMSTP Recursive function used by ADAPTSIM. % % Q = ADAPTSIMSTP('F',A,B,FA,FM,FB,IS,TRACE) tries to % approximate the integral of F(X) from A to B to % an appropriate relative error. The argument 'F' is % a string containing the name of f. The remaining % arguments are generated by ADAPTSIM or by recursion. % % See also ADAPTSIM. % % Walter Gander, 08/03/98

Definition at line 94 of file adaptsim.h.

References Q.

Referenced by adaptsim().

void NR::polint ( const vector< double > &  xa,
const vector< double > &  ya,
const double  x,
double &  y,
double &  dy 
)

Polynomial interpolation using Neville's algorithm.

Let n be the size of arrays xa and ya. If f(x) is the polynomial of degree n-1, such that f(xa[i]) = ya[i], i = 0..n-1, then y = f(x).

Parameters:
xa Vector of x values
ya Vector of corresponding y values, y_i = f(x_i)
x x to interpolate at
y Interpolated f(x)
dy Error estimate (the last dy added to y).

Definition at line 19 of file romberg.cpp.

Referenced by qromb().

template<typename FunctionType>
double NR::trapzd ( FunctionType &  func,
const double  a,
const double  b,
const int  n 
)

Compute the n-th stage of refinement of an extended trapezoidal rule.

Must be called with inceasing n, starting with n=1.

Parameters:
func Function to integrate, must implement operator()(double)
a Left boundary of integral interval
b Right boundary of integral interval
n n-th stage of refinement of trapezoidal rule
Returns:
Computed integral

Definition at line 50 of file romberg.h.

References x.

template<typename FunctionType>
double NR::qtrap ( FunctionType &  func,
double  a,
double  b,
double  tol,
int &  info 
)

Caluculate Int(func(t), t=a..b) using trapezoidal rule.

Parameters:
func Function to integrate, must implement operator()(double)
a Left boundary of integral interval
b Right boundary of integral interval
tol Relative tolerance
Returns:
Computed integral

Definition at line 80 of file romberg.h.

template<typename FunctionType>
double NR::qromb ( FunctionType &  func,
double  a,
double  b,
double  tol,
int &  info 
)

Caluculate Int(func(t), t=a..b) using Romberg integration.

Parameters:
func Function to integrate, must implement operator()(double)
a 
b 
tol Relative tolerance
info Status, 0 means no error
Returns:
Computed integral

Definition at line 112 of file romberg.h.

References polint().

Referenced by eval_gap_voltage().

Here is the call graph for this function:

void NR::spline ( const vector< double > &  x,
const vector< double > &  y,
const double  yp1,
const double  ypn,
vector< double > &  y2 
)

Definition at line 20 of file spline.cpp.

Referenced by CometGapFinder::CometGapFinder().

void NR::splint ( const vector< double > &  xa,
const vector< double > &  ya,
const vector< double > &  y2a,
const double  x,
double &  y 
)

Definition at line 58 of file spline.cpp.

Referenced by CometGapFinder::get_gap().

void NR::spline ( const std::vector< double > &  x,
const std::vector< double > &  y,
const double  yp1,
const double  ypn,
std::vector< double > &  y2 
)

Preprocess spline interpolation. Adapted from Numerical Recipes, Chapter 3.3.

void NR::splint ( const std::vector< double > &  xa,
const std::vector< double > &  ya,
const std::vector< double > &  y2a,
const double  x,
double &  y 
)

Spline interpolation. Adapted from Numerical Recipes, Chapter 3.3.


Generated on Fri Oct 26 13:35:18 2007 for FEMAXX (Finite Element Maxwell Eigensolver) by  doxygen 1.4.7