indii/ml/aux/LengthPartitioner.hpp

00001 #ifndef INDII_ML_AUX_LENGTHPARTITIONER_HPP
00002 #define INDII_ML_AUX_LENGTHPARTITIONER_HPP
00003 
00004 #include "Partitioner.hpp"
00005 
00006 namespace indii {
00007   namespace ml {
00008     namespace aux {
00009 /**
00010  * Partitions a set of weighted points into two sets at the midpoint of
00011  * the widest dimension.    
00012  *
00013  * @author Lawrence Murray <lawrence@indii.org>
00014  * @version $Rev: 477 $
00015  * @date $Date: 2008-07-24 23:39:18 +0100 (Thu, 24 Jul 2008) $
00016  */
00017 class LengthPartitioner : public Partitioner {
00018 public:
00019   /**
00020    * Destructor.
00021    */
00022   virtual ~LengthPartitioner();
00023 
00024   virtual bool init(DiracMixturePdf* p,
00025       const std::vector<unsigned int>& is);
00026   
00027   virtual Partitioner::Partition assign(const vector& x);
00028 
00029 private:
00030   /**
00031    * Index of the dimension on which to split.
00032    */
00033   unsigned int index;
00034   
00035   /**
00036    * Value along which to split.
00037    */
00038   double value;
00039 
00040 };
00041  
00042     }
00043   }
00044 }
00045 
00046 inline indii::ml::aux::Partitioner::Partition
00047     indii::ml::aux::LengthPartitioner::assign(const vector& x) {
00048   if (x(index) <= value) {
00049     return Partitioner::LEFT;
00050   } else {
00051     return Partitioner::RIGHT;
00052   }
00053 }
00054 
00055 #endif
00056 

Generated on Wed Dec 17 15:11:57 2008 for dysii Dynamical Systems Library by  doxygen 1.5.3