📄 kdtreenode.hpp
字号:
#ifndef INDII_ML_AUX_KDTREENODE_HPP#define INDII_ML_AUX_KDTREENODE_HPP#include "PartitionTreeNode.hpp"#include "Norm.hpp"#include "Kernel.hpp"#include "vector.hpp"namespace indii { namespace ml { namespace aux {/** * Node of a KD-tree. * * @author Lawrence Murray <lawrence@indii.org> * @version $Rev: 404 $ * @date $Date: 2008-03-05 14:52:55 +0000 (Wed, 05 Mar 2008) $ * * @param P Degree of the normed vector space (as in \f$\|\cdot\|_p\f$) on * which the tree is defined. * * @section PartitionTreeInternal_serialization Serialization * * This class supports serialization through the Boost.Serialization * library. */class KDTreeNode : public PartitionTreeNode {public: /** * Default constructor. * * This should generally only be used when the object is to be * restored from a serialization. */ KDTreeNode(); /** * Destructor. */ virtual ~KDTreeNode(); /** * Get lower bound on the node. */ virtual vector& getLower() = 0; /** * Get upper bound on the node. */ virtual vector& getUpper() = 0; /** * Find nearest point on hyperrectangle bounary to given point. * * @param x Query point. * * @return Nearest point to x on the boundary of the hyperrectangle * enclosed by the node. */ virtual vector nearestTo(const vector& x) = 0; /** * Calculate density at a single point. * * @param x \f$\mathbf{x}\f$; vector. * @param N \f$\|\mathbf{x}\|_p\f$; a norm. * @param K \f$K(\|\mathbf{x}\|_p)\f$; a density kernel. * * @return Density at \f$\mathbf{x}\f$ using the given norm and kernel. */ virtual double densityAt(const vector& x, Norm& N, Kernel& K) = 0; /** * Sample from the density. * * @param u Weight between zero and the total weight at the node. * @param N \f$\|\mathbf{x}\|_p\f$; a norm. * @param K \f$K(\|\mathbf{x}\|_p)\f$; density kernel from which to * sample. * * @return Sample from the distribution defined by the tree, norm and * kernel. */ virtual vector sample(const double u, Norm& N, Kernel& K) = 0;private: /** * Serialize, or restore from serialization. */ template<class Archive> void serialize(Archive& ar, const unsigned int version); /* * Boost.Serialization requirements. */ friend class boost::serialization::access;}; } }}#include "boost/serialization/base_object.hpp"template<class Archive>void indii::ml::aux::KDTreeNode::serialize(Archive& ar, const unsigned int version) { ar & boost::serialization::base_object<PartitionTreeNode>(*this);}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -