EuclidianDistance.h

Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Written (W) 2007-2009 Soeren Sonnenburg
00008  * Copyright (C) 2007-2009 Fraunhofer Institute FIRST and Max-Planck-Society
00009  */
00010 
00011 #ifndef _EUCLIDIANDISTANCE_H__
00012 #define _EUCLIDIANDISTANCE_H__
00013 
00014 #include <shogun/lib/common.h>
00015 #include <shogun/distance/RealDistance.h>
00016 #include <shogun/features/SimpleFeatures.h>
00017 
00018 namespace shogun
00019 {
00043 class CEuclidianDistance: public CRealDistance
00044 {
00045     public:
00047         CEuclidianDistance();
00048 
00054         CEuclidianDistance(CSimpleFeatures<float64_t>* l, CSimpleFeatures<float64_t>* r);
00055         virtual ~CEuclidianDistance();
00056 
00063         virtual bool init(CFeatures* l, CFeatures* r);
00064 
00066         virtual void cleanup();
00067 
00072         virtual EDistanceType get_distance_type() { return D_EUCLIDIAN; }
00073 
00078         inline virtual EFeatureType get_feature_type() { return F_DREAL; }
00079 
00084         virtual const char* get_name() const { return "EuclidianDistance"; }
00085 
00091         virtual bool get_disable_sqrt() { return disable_sqrt; };
00092 
00098         virtual void set_disable_sqrt(bool state) { disable_sqrt=state; };
00099 
00100     protected:
00104         virtual float64_t compute(int32_t idx_a, int32_t idx_b);
00105 
00106     private:
00107         void init();
00108 
00109     protected:
00111         bool disable_sqrt;
00112 };
00113 
00114 } // namespace shogun
00115 #endif /* _EUCLIDIANDISTANCE_H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation