1 | #ifndef _theplu_yat_statistics_distance_ |
---|
2 | #define _theplu_yat_statistics_distance_ |
---|
3 | |
---|
4 | // $Id: Distance.h 767 2007-02-22 15:14:40Z peter $ |
---|
5 | |
---|
6 | /* |
---|
7 | Copyright (C) The authors contributing to this file. |
---|
8 | |
---|
9 | This file is part of the yat library, http://lev.thep.lu.se/trac/yat |
---|
10 | |
---|
11 | The yat library is free software; you can redistribute it and/or |
---|
12 | modify it under the terms of the GNU General Public License as |
---|
13 | published by the Free Software Foundation; either version 2 of the |
---|
14 | License, or (at your option) any later version. |
---|
15 | |
---|
16 | The yat library is distributed in the hope that it will be useful, |
---|
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
19 | General Public License for more details. |
---|
20 | |
---|
21 | You should have received a copy of the GNU General Public License |
---|
22 | along with this program; if not, write to the Free Software |
---|
23 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
24 | 02111-1307, USA. |
---|
25 | */ |
---|
26 | |
---|
27 | namespace theplu{ |
---|
28 | namespace yat{ |
---|
29 | |
---|
30 | namespace utility { |
---|
31 | class vector; |
---|
32 | } |
---|
33 | namespace classifier { |
---|
34 | class DataLookup1D; |
---|
35 | } |
---|
36 | |
---|
37 | namespace statistics{ |
---|
38 | |
---|
39 | /// |
---|
40 | /// @brief Interface class for calculating distances between arrays. |
---|
41 | /// |
---|
42 | class Distance |
---|
43 | { |
---|
44 | public: |
---|
45 | |
---|
46 | /// |
---|
47 | /// @brief The default constructor |
---|
48 | /// |
---|
49 | Distance(void); |
---|
50 | |
---|
51 | /// |
---|
52 | /// @brief The destructor |
---|
53 | /// |
---|
54 | virtual ~Distance(void); |
---|
55 | |
---|
56 | /// |
---|
57 | /// @return distance |
---|
58 | /// |
---|
59 | virtual double operator()(const utility::vector& x, |
---|
60 | const utility::vector& y) const = 0; |
---|
61 | |
---|
62 | |
---|
63 | /// |
---|
64 | /// This function is virtual, and implemented in this base class |
---|
65 | /// copying the lookups to utilty::vectors followed by calling |
---|
66 | /// appropriate function. If speed is crucial you can implement |
---|
67 | /// this function in inherited class avoiding the copying. |
---|
68 | /// |
---|
69 | /// @return distance |
---|
70 | /// |
---|
71 | virtual double operator()(const classifier::DataLookup1D& x, |
---|
72 | const classifier::DataLookup1D& y) const; |
---|
73 | |
---|
74 | |
---|
75 | /// |
---|
76 | /// @return weighted distance |
---|
77 | /// |
---|
78 | virtual double operator()(const utility::vector& x, |
---|
79 | const utility::vector& y, |
---|
80 | const utility::vector& wx, |
---|
81 | const utility::vector& wy) const = 0; |
---|
82 | |
---|
83 | /// |
---|
84 | /// This function is virtual, and implemented in this base class |
---|
85 | /// copying the lookups to utilty::vectors followed by calling |
---|
86 | /// appropiate function. If speed is crucial you can implement |
---|
87 | /// this function in inherited class avoiding the copying. |
---|
88 | /// |
---|
89 | /// @return weighted distance |
---|
90 | /// |
---|
91 | virtual double operator()(const classifier::DataLookup1D& x, |
---|
92 | const classifier::DataLookup1D& y, |
---|
93 | const classifier::DataLookup1D& wx, |
---|
94 | const classifier::DataLookup1D& wy) const; |
---|
95 | |
---|
96 | private: |
---|
97 | }; |
---|
98 | |
---|
99 | }}} // of namespace statistics, yat, and theplu |
---|
100 | |
---|
101 | #endif |
---|