npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0

#include <GridInterpolatedDistribution.hh>

Inheritance diagram for npstat::GridInterpolatedDistribution:
npstat::AbsDistributionND

Public Member Functions

 GridInterpolatedDistribution (const std::vector< GridAxis > &axes, unsigned distributionDimension, bool interpolateCopulas, bool useNearestGridCellOnly=false)
 
 GridInterpolatedDistribution (const GridInterpolatedDistribution &)
 
GridInterpolatedDistributionoperator= (const GridInterpolatedDistribution &)
 
virtual GridInterpolatedDistributionclone () const
 
void setGridDistro (const unsigned *cell, unsigned lenCell, AbsDistributionND *distro, bool assumeOwnership=true)
 
void setLinearDistro (unsigned long idx, AbsDistributionND *distro, bool assumeOwnership=true)
 
const AbsDistributionNDgetGridDistro (const unsigned *cell, unsigned lenCell) const
 
const AbsDistributionNDgetLinearDistro (unsigned long idx) const
 
void setGridCoords (const double *coords, unsigned lenCoords)
 
void interpolateCopulas (bool b)
 
void useSingleCell (bool b)
 
unsigned nAxes () const
 
const GridAxisgetAxis (const unsigned i) const
 
unsigned long nDistros () const
 
ArrayShape gridShape () const
 
bool interpolatingCopulas () const
 
bool usingSingleCell () const
 
double density (const double *x, unsigned dim) const
 
void unitMap (const double *rnd, unsigned len, double *x) const
 
bool mappedByQuantiles () const
 
double marginalDensity (unsigned idim, double x) const
 
double marginalCdf (unsigned idim, double x) const
 
double marginalExceedance (unsigned idim, double x) const
 
double marginalQuantile (unsigned idim, double x) const
 
double copulaDensity (const double *x, unsigned dim) const
 
double productOfTheMarginals (const double *x, unsigned dim) const
 
virtual gs::ClassId classId () const
 
virtual bool write (std::ostream &of) const
 
- Public Member Functions inherited from npstat::AbsDistributionND
 AbsDistributionND (const unsigned dim)
 
 AbsDistributionND (const AbsDistributionND &r)
 
AbsDistributionNDoperator= (const AbsDistributionND &r)
 
bool operator== (const AbsDistributionND &r) const
 
bool operator!= (const AbsDistributionND &r) const
 
unsigned dim () const
 
virtual unsigned random (AbsRandomGenerator &g, double *x, unsigned lenX) const
 

Static Public Member Functions

static const char * classname ()
 
static unsigned version ()
 
static GridInterpolatedDistributionread (const gs::ClassId &id, std::istream &in)
 
- Static Public Member Functions inherited from npstat::AbsDistributionND
static const char * classname ()
 
static unsigned version ()
 
static AbsDistributionNDread (const gs::ClassId &id, std::istream &)
 

Protected Member Functions

virtual bool isEqual (const AbsDistributionND &r) const
 

Additional Inherited Members

- Protected Attributes inherited from npstat::AbsDistributionND
const unsigned dim_
 

Detailed Description

This class interpolates between probability distributions placed at the points of a rectangular (not necessarily equidistant) grid. The weights in the interpolations are determined in the multilinear fashion. Multivariate quantile or copula interpolation method can be used, depending on the types of interpolated densities.

Constructor & Destructor Documentation

◆ GridInterpolatedDistribution()

npstat::GridInterpolatedDistribution::GridInterpolatedDistribution ( const std::vector< GridAxis > &  axes,
unsigned  distributionDimension,
bool  interpolateCopulas,
bool  useNearestGridCellOnly = false 
)

Constructor arguments "axes" and "distributionDimension" are, respectively, the collection of parameter grid axes and the dimensionality of the associated distributions.

If "interpolateCopulas" is true, copula interpolation method will be used (as implemented by class CopulaInterpolationND), otherwise unit map interpolation will be used.

If "useNearestGridCellOnly" is true, interpolation will be disabled and only the distribution corresponding to the nearest grid cell will be used.

Member Function Documentation

◆ classId()

virtual gs::ClassId npstat::GridInterpolatedDistribution::classId ( ) const
inlinevirtual

Prototype needed for I/O

Implements npstat::AbsDistributionND.

◆ clone()

virtual GridInterpolatedDistribution* npstat::GridInterpolatedDistribution::clone ( ) const
inlinevirtual

"Virtual copy constructor"

Implements npstat::AbsDistributionND.

◆ density()

double npstat::GridInterpolatedDistribution::density ( const double *  x,
unsigned  dim 
) const
virtual

Method inherited from AbsDistributionND

Implements npstat::AbsDistributionND.

◆ getGridDistro()

const AbsDistributionND* npstat::GridInterpolatedDistribution::getGridDistro ( const unsigned *  cell,
unsigned  lenCell 
) const

Get the distribution associated with the given parameter grid cell. Note that null pointer will be returned in case the cell has not been set yet.

◆ getLinearDistro()

const AbsDistributionND* npstat::GridInterpolatedDistribution::getLinearDistro ( unsigned long  idx) const

Get the distribution associated with the given parameter grid cell using a linear index for the cell. Note that null pointer will be returned in case the cell has not been set yet.

◆ interpolateCopulas()

void npstat::GridInterpolatedDistribution::interpolateCopulas ( bool  b)

Switch between unit map interpolation and copula interpolation

◆ mappedByQuantiles()

bool npstat::GridInterpolatedDistribution::mappedByQuantiles ( ) const
virtual

The following method should return "true" in case the "unitMap" method is implemented by a sequence of conditional quantile functions. Distributions with such maps permit quantile-based interpolation procedures.

Implements npstat::AbsDistributionND.

◆ marginalDensity()

double npstat::GridInterpolatedDistribution::marginalDensity ( unsigned  idim,
double  x 
) const

This method works for copula interpolation only. Naturally, all interpolated distributions in this case must be of type (or must inherit from) CompositeDistributionND.

◆ nAxes()

unsigned npstat::GridInterpolatedDistribution::nAxes ( ) const
inline

Inspect object properties

◆ setGridCoords()

void npstat::GridInterpolatedDistribution::setGridCoords ( const double *  coords,
unsigned  lenCoords 
)

The following function must be called before calculating the density. The length of the coordinates array must be equal to the number of grid axes.

◆ setGridDistro()

void npstat::GridInterpolatedDistribution::setGridDistro ( const unsigned *  cell,
unsigned  lenCell,
AbsDistributionND distro,
bool  assumeOwnership = true 
)

Associate a distribution with the given parameter grid cell.

This object will assume the ownership of the "distro" pointer if "assumeOwnership" is true and will make a copy of it if "assumeOwnership" is false. All distributions must be set before density can be calculated on all points inside and outside the grid.

◆ setLinearDistro()

void npstat::GridInterpolatedDistribution::setLinearDistro ( unsigned long  idx,
AbsDistributionND distro,
bool  assumeOwnership = true 
)

Associate a distribution with the given parameter grid cell using a linear index for the cell

◆ unitMap()

void npstat::GridInterpolatedDistribution::unitMap ( const double *  rnd,
unsigned  bufLen,
double *  x 
) const
virtual

Mapping from the unit hypercube into the density support region. Note that "bufLen" does not have to be equal to the dimensionality of the function. There may be an efficient way to generate just the leading dimensions in case "bufLen" is smaller than the dimensionality.

Implements npstat::AbsDistributionND.

◆ useSingleCell()

void npstat::GridInterpolatedDistribution::useSingleCell ( bool  b)

Switch between normal interpolation and using just one cell


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