SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
EuclideanDistance.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2007-2009 Soeren Sonnenburg
8  * Written (W) 2016 Soumyajit De
9  * Copyright (C) 2007-2009 Fraunhofer Institute FIRST and Max-Planck-Society
10  */
11 
12 #ifndef _EUCLIDEANDISTANCE_H__
13 #define _EUCLIDEANDISTANCE_H__
14 
15 #include <shogun/lib/config.h>
17 
18 namespace shogun
19 {
20 
21 class CFeatures;
22 class CDotFeatures;
23 template <typename T> class SGVector;
24 
59 {
60 public:
63 
70 
72  virtual ~CEuclideanDistance();
73 
80  virtual bool init(CFeatures* l, CFeatures* r);
81 
83  virtual void cleanup();
84 
90 
95  virtual EFeatureClass get_feature_class() { return C_ANY; }
96 
101  virtual EFeatureType get_feature_type() { return F_DREAL; }
102 
107  virtual const char* get_name() const { return "EuclideanDistance"; }
108 
114  virtual bool get_disable_sqrt() { return disable_sqrt; };
115 
121  virtual void set_disable_sqrt(bool state) { disable_sqrt=state; };
122 
135  virtual float64_t distance_upper_bounded(int32_t idx_a, int32_t idx_b, float64_t upper_bound);
136 
142  virtual void precompute_rhs();
143 
149  virtual void precompute_lhs();
150 
155  virtual void reset_precompute();
156 
165  virtual CFeatures* replace_rhs(CFeatures* rhs);
166 
175  virtual CFeatures* replace_lhs(CFeatures* lhs);
176 
177 protected:
181  virtual float64_t compute(int32_t idx_a, int32_t idx_b);
182 
185 
188 
191 
192 private:
194  void register_params();
195 
196 };
197 
198 } // namespace shogun
199 #endif /* _EUCLIDEANDISTANCE_H__ */
virtual CFeatures * replace_rhs(CFeatures *rhs)
virtual const char * get_name() const
Class Distance, a base class for all the distances used in the Shogun toolbox.
Definition: Distance.h:87
Features that support dot products among other operations.
Definition: DotFeatures.h:44
EFeatureClass
shogun feature class
Definition: FeatureTypes.h:38
virtual float64_t compute(int32_t idx_a, int32_t idx_b)
virtual float64_t distance_upper_bounded(int32_t idx_a, int32_t idx_b, float64_t upper_bound)
EDistanceType
Definition: Distance.h:32
virtual CFeatures * replace_lhs(CFeatures *lhs)
virtual void set_disable_sqrt(bool state)
virtual EDistanceType get_distance_type()
double float64_t
Definition: common.h:50
virtual bool init(CFeatures *l, CFeatures *r)
EFeatureType
shogun feature type
Definition: FeatureTypes.h:19
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
SGVector< float64_t > m_lhs_squared_norms
CFeatures * lhs
feature vectors to occur on the left hand side
Definition: Distance.h:381
The class Features is the base class of all feature objects.
Definition: Features.h:68
CFeatures * rhs
feature vectors to occur on the right hand side
Definition: Distance.h:383
virtual EFeatureClass get_feature_class()
SGVector< float64_t > m_rhs_squared_norms
virtual EFeatureType get_feature_type()
class EuclideanDistance

SHOGUN Machine Learning Toolbox - Documentation