npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
scanMultivariateDensityAsWeight.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_SCANMULTIVARIATEDENSITYASWEIGHT_HH_
2 #define NPSTAT_SCANMULTIVARIATEDENSITYASWEIGHT_HH_
3 
4 /*!
5 // \file scanMultivariateDensityAsWeight.hh
6 //
7 // \brief Scan a multivariate density for subsequent use as a tabulated weight
8 //
9 // Author: I. Volobouev
10 //
11 // September 2019
12 */
13 
14 #include <stdexcept>
15 
16 #include "npstat/nm/ArrayND.hh"
18 
19 namespace npstat {
20  /**
21  // Utility function for scanning multivariate kernels and returning
22  // ArrayND of minimal size which encloses the complete density support
23  // region.
24  //
25  // Arguments are as follows:
26  //
27  // kernel -- the density to scan
28  //
29  // maxDim -- maximum number of steps to make in each dimension.
30  // All values must be odd.
31  //
32  // bandwidthSet -- density function bandwidth values in each dimension
33  //
34  // stepSize -- scan step size in each dimension
35  //
36  // arrayLength -- number of elements in each of the arrays
37  // maxOctantDim, bandwidthSet, and stepSize
38  */
39  CPP11_auto_ptr<ArrayND<double> > scanMultivariateDensityAsWeight(
40  const AbsDistributionND& kernel, const unsigned* maxDim,
41  const double* bandwidthSet, const double* stepSize,
42  unsigned arrayLength);
43 
44 #ifdef SWIG
45  inline ArrayND<double>* scanMultivariateDensityAsWeight2(
46  const AbsDistributionND& kernel,
47  const unsigned* maxDim, unsigned len1,
48  const double* bandwidthSet, unsigned len2,
49  const double* stepSize, unsigned len3)
50  {
51  const unsigned dim = kernel.dim();
52  if (!dim || len1 != dim || len2 != dim || len3 != dim)
53  throw std::invalid_argument(
54  "In npstat::scanMultivariateDensityAsWeight2: "
55  "incompatible argument dimensions");
56  CPP11_auto_ptr<ArrayND<double> > p = scanMultivariateDensityAsWeight(
57  kernel, maxDim, bandwidthSet, stepSize, dim);
58  return p.release();
59  }
60 #endif // SWIG
61 }
62 
63 #endif // NPSTAT_SCANMULTIVARIATEDENSITYASWEIGHT_HH_
Interface definition for multivariate continuous statistical distributions.
Arbitrary-dimensional array template.
Definition: AbsDistributionND.hh:26
unsigned dim() const
Definition: AbsDistributionND.hh:51
Definition: AbsArrayProjector.hh:14
CPP11_auto_ptr< ArrayND< double > > scanMultivariateDensityAsWeight(const AbsDistributionND &kernel, const unsigned *maxDim, const double *bandwidthSet, const double *stepSize, unsigned arrayLength)