1 | #ifndef _theplu_yat_statistics_distance_ |
---|
2 | #define _theplu_yat_statistics_distance_ |
---|
3 | |
---|
4 | // $Id: Distance.h 683 2006-10-11 22:20:36Z jari $ |
---|
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 | /// Interface class for calculating distances between arrays. |
---|
41 | /// |
---|
42 | class Distance |
---|
43 | { |
---|
44 | public: |
---|
45 | |
---|
46 | Distance() |
---|
47 | { |
---|
48 | } |
---|
49 | |
---|
50 | virtual ~Distance() |
---|
51 | { |
---|
52 | } |
---|
53 | |
---|
54 | /// |
---|
55 | /// @return distance |
---|
56 | /// |
---|
57 | virtual double operator()(const utility::vector& x, |
---|
58 | const utility::vector& y) const = 0; |
---|
59 | |
---|
60 | |
---|
61 | /// |
---|
62 | /// This function is virtual, and implemented in this base class |
---|
63 | /// copying the lookups to utilty::vectors followed by calling |
---|
64 | /// appropriate function. If speed is crucial you can implement |
---|
65 | /// this function in inherited class avoiding the copying. |
---|
66 | /// |
---|
67 | /// @return distance |
---|
68 | /// |
---|
69 | virtual double operator()(const classifier::DataLookup1D& x, |
---|
70 | const classifier::DataLookup1D& y) const; |
---|
71 | |
---|
72 | |
---|
73 | /// |
---|
74 | /// @return weighted distance |
---|
75 | /// |
---|
76 | virtual double operator()(const utility::vector& x, |
---|
77 | const utility::vector& y, |
---|
78 | const utility::vector& wx, |
---|
79 | const utility::vector& wy) const = 0; |
---|
80 | |
---|
81 | /// |
---|
82 | /// This function is virtual, and implemented in this base class |
---|
83 | /// copying the lookups to utilty::vectors followed by calling |
---|
84 | /// appropiate function. If speed is crucial you can implement |
---|
85 | /// this function in inherited class avoiding the copying. |
---|
86 | /// |
---|
87 | /// @return weighted distance |
---|
88 | /// |
---|
89 | virtual double operator()(const classifier::DataLookup1D& x, |
---|
90 | const classifier::DataLookup1D& y, |
---|
91 | const classifier::DataLookup1D& wx, |
---|
92 | const classifier::DataLookup1D& wy) const; |
---|
93 | |
---|
94 | private: |
---|
95 | }; |
---|
96 | |
---|
97 | }}} // of namespace statistics, yat, and theplu |
---|
98 | |
---|
99 | #endif |
---|