npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
npstat::QuadraticOrthoPolyND Class Reference

#include <QuadraticOrthoPolyND.hh>

Public Member Functions

 QuadraticOrthoPolyND (const AbsDistributionND &weight, const BoxND< double > &boundingBox, const unsigned *nSteps, unsigned nStepsDim)
 
 QuadraticOrthoPolyND (const QuadraticOrthoPolyND &)
 
QuadraticOrthoPolyNDoperator= (const QuadraticOrthoPolyND &)
 
unsigned dim () const
 
unsigned nTerms () const
 
const AbsDistributionNDweight () const
 
const BoxND< double > & boundingBox () const
 
const std::vector< unsigned > & nSteps () const
 
double monomialCoefficient (unsigned iPoly, unsigned iMono) const
 
double value (unsigned polyN, const double *x, unsigned lenX) const
 
double series (const double *x, unsigned lenX, const double *coeffs, unsigned nCoeffs, double *individualPolynomials=0) const
 
void gradient (const double *x, unsigned lenX, const double *coeffs, unsigned nCoeffs, double *result, unsigned lenResult) const
 
void hessian (const double *coeffs, unsigned nCoeffs, double *result, unsigned lenResult) const
 
template<class T , typename Numeric >
void fit (const T &obj, Numeric(T::*)(const double *, unsigned) const, const double *location, const double *scale, unsigned nScales, double *coeffs, unsigned nCoeffs) const
 

Detailed Description

Class for figuring out the coefficients of multivariate quadratic orthogonal polynomials generated with an arbitrary weight functions

Constructor & Destructor Documentation

◆ QuadraticOrthoPolyND()

npstat::QuadraticOrthoPolyND::QuadraticOrthoPolyND ( const AbsDistributionND weight,
const BoxND< double > &  boundingBox,
const unsigned *  nSteps,
unsigned  nStepsDim 
)

"weight" is the weigh function used to build the orthogonal polynomials. "nSteps" is the number of integration intervals in each dimension (numerical integration is used for orthogonalization of the basis polynomials and for subsequent construction of polynomial series). "nStepsDim" is the number of elements in the "nSteps" array and also the dimensionality of the coordinate space. The integration region is defined by the "boundingBox" argument whose dimensionality must be consistent with "nStepsDim".

Integration will be performed by simply evaluating the functions at the interval centers. Use a sufficiently large number of integration points if high precision is desired.

Member Function Documentation

◆ dim()

unsigned npstat::QuadraticOrthoPolyND::dim ( ) const
inline

Inspect object properties

◆ fit()

template<class T , typename Numeric >
void npstat::QuadraticOrthoPolyND::fit ( const T &  obj,
Numeric(T::*)(const double *, unsigned) const  ,
const double *  location,
const double *  scale,
unsigned  nScales,
double *  coeffs,
unsigned  nCoeffs 
) const

The following method fits orthogonal polynomial series to an object which has its own method with signature "Numeric method(const double* x, unsigned dimX) const". The arguments which will be fed into this method will be shifted and scaled from the box coordinates according to x[i] = (boxCoordinate[i] - location[i])/scale[i]. It must be possible to perform a static cast from "Numeric" to double.

"nCoeffs" can have multiple values, as in the "series" method. The bounding box and the number of integration intervals are assumed to be the same as in the constructor.

◆ gradient()

void npstat::QuadraticOrthoPolyND::gradient ( const double *  x,
unsigned  lenX,
const double *  coeffs,
unsigned  nCoeffs,
double *  result,
unsigned  lenResult 
) const

The gradient of the series expansion. The size of the result array must be equal to "dim()". Note that the code does not check whether the coordinate is inside the original box.

◆ hessian()

void npstat::QuadraticOrthoPolyND::hessian ( const double *  coeffs,
unsigned  nCoeffs,
double *  result,
unsigned  lenResult 
) const

The hessian of the series expansion. The size of the result array must be equal to "dim()*(dim()+1)/2". Hessian matrix is returned in the upper-trangular form. The result is, of course, coordinate-independent.

◆ monomialCoefficient()

double npstat::QuadraticOrthoPolyND::monomialCoefficient ( unsigned  iPoly,
unsigned  iMono 
) const

Coefficient in the expansion of the orthogonal series polynomial in the monomial basis. The order of the monomials is 1, x0, x1, ..., xN, x0^2, x0*x1, ..., x0*xN, x1^2, x1*x2, ... The number of the polynomials is, of course, the same as the number of monomials and equals "nTerms()".

◆ series()

double npstat::QuadraticOrthoPolyND::series ( const double *  x,
unsigned  lenX,
const double *  coeffs,
unsigned  nCoeffs,
double *  individualPolynomials = 0 
) const

Series expansion at the given coordinate "x". The number of coefficients provided, nCoeffs, is allowed to take the following values:

1 – just return the constant term dim() + 1 – use linear terms only nTerms() – use the full expansion

Note that the code does not check whether the coordinate is inside the original box.

If the "individualPolynomials" array is not 0, the values of the individual polynomials will be stored there. They represent the gradient of the series expansion at the given point with respect to the series coefficients. There must be at least nCoeffs elements in the "individualPolynomials" array.

◆ value()

double npstat::QuadraticOrthoPolyND::value ( unsigned  polyN,
const double *  x,
unsigned  lenX 
) const

Value of a certain polynomial at the given coordinate "x". The argument "polyN" is the polynomial number which should be less than "nTerms()". Note that the code does not check whether the coordinate is inside the original box.


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