indii/ml/aux/KDTreeLeafNode.hpp

00001 #ifndef INDII_ML_AUX_KDTREELEAFNODE_HPP
00002 #define INDII_ML_AUX_KDTREELEAFNODE_HPP
00003 
00004 #include "KDTreeNode.hpp"
00005 #include "DiracMixturePdf.hpp"
00006 
00007 namespace indii {
00008   namespace ml {
00009     namespace aux {
00010 /**
00011  * Leaf node of a KD-tree.
00012  *
00013  * @author Lawrence Murray <lawrence@indii.org>
00014  * @version $Rev: 404 $
00015  * @date $Date: 2008-03-05 14:52:55 +0000 (Wed, 05 Mar 2008) $
00016  *
00017  * @param P Degree of the normed vector space (as in \f$\|\cdot\|_p\f$) on
00018  * which the tree is defined.
00019  *
00020  * @section PartitionTreeInternal_serialization Serialization
00021  *
00022  * This class supports serialization through the Boost.Serialization
00023  * library.
00024  */
00025 class KDTreeLeafNode : public KDTreeNode {
00026 public:
00027   /**
00028    * Default constructor.
00029    *
00030    * This should generally only be used when the object is to be
00031    * restored from a serialization.
00032    */
00033   KDTreeLeafNode();
00034 
00035   /**
00036    * Constructor.
00037    *
00038    * @param x Sample point.
00039    * @param w Weight.
00040    */
00041   KDTreeLeafNode(const vector& x, const double w);
00042 
00043   /**
00044    * Destructor.
00045    */
00046   virtual ~KDTreeLeafNode();
00047 
00048   virtual double getWeight();
00049 
00050   virtual vector& getLower();
00051 
00052   virtual vector& getUpper();
00053 
00054   virtual vector nearestTo(const vector& x);
00055 
00056   virtual double densityAt(const vector& x, Norm& N, Kernel& K);
00057 
00058   virtual vector sample(const double u, Norm& N, Kernel& K);
00059   
00060 private:
00061   /**
00062    * The point.
00063    */
00064   vector x;
00065   
00066   /**
00067    * The weight.
00068    */
00069   double w;
00070 
00071   /**
00072    * Serialize, or restore from serialization.
00073    */
00074   template<class Archive>
00075   void serialize(Archive& ar, const unsigned int version);
00076 
00077   /*
00078    * Boost.Serialization requirements.
00079    */
00080   friend class boost::serialization::access;
00081 
00082 };
00083 
00084     }
00085   }
00086 }
00087 
00088 #include "boost/serialization/base_object.hpp"
00089 
00090 template<class Archive>
00091 void indii::ml::aux::KDTreeLeafNode::serialize(Archive& ar,
00092     const unsigned int version) {
00093   ar & boost::serialization::base_object<KDTreeNode>(*this);
00094   ar & x;
00095   ar & w;
00096 }
00097 
00098 #endif
00099 

Generated on Wed Mar 5 16:44:42 2008 for dysii Dynamical Systems Library by  doxygen 1.5.2