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) 2008-2009 Christian Gehl 00008 * Copyright (C) 2008-2009 Fraunhofer Institute FIRST 00009 */ 00010 00011 #ifndef __CHISQUAREDISTANCE_H__ 00012 #define __CHISQUAREDISTANCE_H__ 00013 00014 #include <shogun/lib/common.h> 00015 #include <shogun/distance/DenseDistance.h> 00016 00017 namespace shogun 00018 { 00032 class CChiSquareDistance: public CDenseDistance<float64_t> 00033 { 00034 public: 00036 CChiSquareDistance(); 00037 00043 CChiSquareDistance(CDenseFeatures<float64_t>* l, CDenseFeatures<float64_t>* r); 00044 virtual ~CChiSquareDistance(); 00045 00052 virtual bool init(CFeatures* l, CFeatures* r); 00053 00055 virtual void cleanup(); 00056 00061 virtual EDistanceType get_distance_type() { return D_CHISQUARE; } 00062 00067 virtual const char* get_name() const { return "ChiSquareDistance"; } 00068 00069 protected: 00073 virtual float64_t compute(int32_t idx_a, int32_t idx_b); 00074 }; 00075 00076 } // namespace shogun 00077 #endif /* _CHISQUAREDISTANCE_H___ */