npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
npstat::KDEFilterND< MaxDeg > Class Template Reference

#include <KDEFilterND.hh>

Inheritance diagram for npstat::KDEFilterND< MaxDeg >:
npstat::AbsPolyFilterND

Public Types

enum  { deg_size = MaxDeg }
 

Public Member Functions

template<class Array >
 KDEFilterND (const double *taper, unsigned maxDegree, const Array &weight, ConvolutionEngineND &engine, unsigned long id, ArrayND< double > &workBuffer, bool mirrorData=true, bool mirrorWeight=true, bool manageSlot=true)
 
unsigned dim () const
 
unsigned maxDegree () const
 
ArrayShape dataShape () const
 
double taper (unsigned degree) const
 
bool mirrorsData () const
 
unsigned long engineSlotId () const
 
double filterAtTheCenter () const
 
double selfContribution (const unsigned *index, unsigned indexLen) const
 
double linearSelfContribution (unsigned long index) const
 
bool selfContributionVaries () const
 
template<class Array >
bool isCompatible (const Array &in) const
 
template<class ArrIn , class ArrOut >
void filter (const ArrIn &in, ArrOut *out) const
 
template<class ArrIn , class ArrOut >
void convolve (const ArrIn &in, ArrOut *out) const
 

Static Public Member Functions

static unsigned classMaxDegree ()
 

Detailed Description

template<unsigned MaxDeg>
class npstat::KDEFilterND< MaxDeg >

This class performs kernel density estimation on a regularly spaced multivariate grid with arbitrary, tabulated symmetric kernels

Constructor & Destructor Documentation

◆ KDEFilterND()

template<unsigned MaxDeg>
template<class Array >
npstat::KDEFilterND< MaxDeg >::KDEFilterND ( const double *  taper,
unsigned  maxDegree,
const Array &  weight,
ConvolutionEngineND engine,
unsigned long  id,
ArrayND< double > &  workBuffer,
bool  mirrorData = true,
bool  mirrorWeight = true,
bool  manageSlot = true 
)

Main constructor. The arguments are as follows:

taper – Damping factors for each polynomial degree (starting with the 0th order term). This can be NULL in which case it is assumed that all factors are 1.

maxDegree – Maximum degree of the polynomials. The value must not exceed the "MaxDeg" template parameter. The length of the "taper" array (if not NULL) must be equal to maxDegree + 1. Note that the same filter will be produced using an even degree N and an odd degree N+1.

weight – The array of weights. By default, this is just one hyperoctant corresponding to positive directions in all dimensions. The remaining part of the kernel is generated by reflections. If the full weight is provided instead, change the "mirrorWeight" default.

engine – The engine to use for convolutions. This object will not make its own copy of the engine. It is the responsibility of the user to ensure that the lifetime of the engine exceeds the lifetime of this object. It is assumed that the size of the arrays to filter will be two times smaller in each dimension than what is expected by the engine. Note that dimensionalities of weight array must not exceed data dimensionalities.

id – Filter slot number in the engine. Each filter used with this particular engine must be provided with a unique slot id.

workBuffer – Buffer array for various calculations. Must have the same shape as the convolution engine. Will not be copied internally. Must exist while this object operates.

mirrorData – If true, the data will be mirrored at the boundaries to reduce the edge effects.

mirrorWeight – If true, the weight will be mirrored. If false, the weight is considered to be complete. In the latter case the array size in each dimension must be odd and the weight should be centered in the array.

manageSlot – If true, the Fourier transform of this filter will be removed from the engine filter collection in the destructor of this object.

Member Function Documentation

◆ convolve()

template<unsigned MaxDeg>
template<class ArrIn , class ArrOut >
void npstat::KDEFilterND< MaxDeg >::convolve ( const ArrIn &  in,
ArrOut *  out 
) const
inline

This method is included for compatibility with LocalPolyFilterND. For KDE, there is no difference between "convolve" and "filter".

◆ dataShape()

template<unsigned MaxDeg>
ArrayShape npstat::KDEFilterND< MaxDeg >::dataShape ( ) const
inlinevirtual

Required shape of the data array

Implements npstat::AbsPolyFilterND.

◆ dim()

template<unsigned MaxDeg>
unsigned npstat::KDEFilterND< MaxDeg >::dim ( ) const
inlinevirtual

Inspect object properties

Implements npstat::AbsPolyFilterND.

◆ filter()

template<unsigned MaxDeg>
template<class ArrIn , class ArrOut >
void npstat::KDEFilterND< MaxDeg >::filter ( const ArrIn &  in,
ArrOut *  out 
) const

The method which performs the filtering

◆ isCompatible()

template<unsigned MaxDeg>
template<class Array >
bool npstat::KDEFilterND< MaxDeg >::isCompatible ( const Array &  in) const
inline

Check the compatibility of an array with the filter

◆ linearSelfContribution()

template<unsigned MaxDeg>
double npstat::KDEFilterND< MaxDeg >::linearSelfContribution ( unsigned long  index) const
virtual

Contribution of a single point into the density estimate using the linear index of the point

Implements npstat::AbsPolyFilterND.

◆ selfContribution()

template<unsigned MaxDeg>
double npstat::KDEFilterND< MaxDeg >::selfContribution ( const unsigned *  index,
unsigned  indexLen 
) const
virtual

Contribution of a single point into the density estimate at that point (not normalized). This is needed for various leaving-one-out cross validation procedures.

Implements npstat::AbsPolyFilterND.

◆ selfContributionVaries()

template<unsigned MaxDeg>
bool npstat::KDEFilterND< MaxDeg >::selfContributionVaries ( ) const
inline

Check if the self contribution varies from point to point


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