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) 2011 Miguel Angel Bautista 00008 * Copyright (C) 2011 Berlin Institute of Technology and Max Planck Society 00009 */ 00010 00011 #ifndef _ATTENUATEDEuclideanDISTANCE_H__ 00012 #define _ATTENUATEDEuclideanDISTANCE_H__ 00013 00014 #include <shogun/lib/common.h> 00015 #include <shogun/distance/RealDistance.h> 00016 #include <shogun/features/DenseFeatures.h> 00017 00018 namespace shogun 00019 { 00038 class CAttenuatedEuclideanDistance: public CRealDistance 00039 { 00040 public: 00042 CAttenuatedEuclideanDistance(); 00043 00049 CAttenuatedEuclideanDistance(CDenseFeatures<float64_t>* l, CDenseFeatures<float64_t>* r); 00050 virtual ~CAttenuatedEuclideanDistance(); 00051 00058 virtual bool init(CFeatures* l, CFeatures* r); 00059 00061 virtual void cleanup(); 00062 00067 virtual EDistanceType get_distance_type() { return D_ATTENUATEDEUCLIDEAN; } 00068 00073 virtual EFeatureType get_feature_type() { return F_DREAL; } 00074 00079 virtual const char* get_name() const { return "AttenuatedEuclideanDistance"; } 00080 00086 virtual bool get_disable_sqrt() { return disable_sqrt; }; 00087 00093 virtual void set_disable_sqrt(bool state) { disable_sqrt=state; }; 00094 00095 protected: 00099 virtual float64_t compute(int32_t idx_a, int32_t idx_b); 00100 00101 private: 00102 void init(); 00103 00104 protected: 00106 bool disable_sqrt; 00107 }; 00108 00109 } // namespace shogun 00110 #endif /* _ATTENUATEDEuclideanDISTANCE_H__ */