Template Struct KernelDensityData
Defined in File KernelDensity.hpp
Inheritance Relationships
Base Type
public kden::KDTreeData< void >(Template Struct KDTreeData)
Struct Documentation
-
template<typename AuxType = void>
struct KernelDensityData : public kden::KDTreeData<void> Weighted points for a KernelDensity: a KDTreeData plus one weight per point.
Adds a flat array of weights (w_, N doubles) to KDTreeData’s positions and auxiliary data, and extends swap() and validate() to cover it, so that building a tree over the points reorders the weights along with them. Like KDTreeData, a non-owning view of the caller’s storage (see OwnedKernelDensityData).
- Template Parameters:
AuxType – Type of the auxiliary data carried by each point, or void (the default) for none; see KDTreeData
Public Functions
-
inline auto weight(const std::size_t i) const -> double
Weight of a point.
- Parameters:
i – Index of the point
- Returns:
Its weight
-
inline void validate() const
Check that the arrays are consistent with one another, and finite.
Non-finite weights would make the nodes’ weight sums non-finite, and the kernel density estimates bound a node’s contribution by its total weight times the range of kernel values over its bounding box, which holds only if no weight is negative.
- Throws:
std::invalid_argument – for any of the reasons KDTreeData::validate() does, or if w_ does not have one element per point, or any weight is negative or not finite
-
inline void swap(const std::size_t i, const std::size_t j)
Exchange two points: their positions, auxiliary data, and weights.
- Parameters:
i – Index of one point
j – Index of the other
Public Members
-
std::span<double> w_
Weights, one per point (not owned)