yat  0.9.3pre
SVindex.h
1 #ifndef _theplu_yat_classifier_sv_index_
2 #define _theplu_yat_classifier_sv_index_
3 
4 // $Id: SVindex.h 2119 2009-12-12 23:11:43Z peter $
5 
6 /*
7  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
8 
9  This file is part of the yat library, http://dev.thep.lu.se/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 3 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 yat. If not, see <http://www.gnu.org/licenses/>.
23 */
24 
25 #include <vector>
26 
27 namespace theplu {
28 namespace yat {
29 
30 namespace utility {
31  class Vector;
32 }
33 
34 namespace classifier {
35 
43  class SVindex
44  {
45 
46  public:
48  SVindex();
49 
51  SVindex(const size_t);
52 
54  size_t index_first(void) const;
55 
57  size_t index_second(void) const;
58 
60  void init(const utility::Vector& alpha, const double);
61 
63  size_t nof_sv(void) const;
64 
66  void nsv_first(void);
67 
69  void nsv_second(void);
70 
73  void shuffle(void);
74 
76  size_t size(void) const;
77 
79  void sv_first(void);
80 
82  void sv_second(void);
83 
85  void update_first(const size_t i);
86 
88  void update_second(const size_t i);
89 
91  size_t value_first(void) const;
92 
94  size_t value_second(void) const;
95 
97  size_t operator()(size_t i) const;
98 
99  private:
100  size_t index_first_;
101  size_t index_second_;
102  size_t nof_sv_;
103  std::vector<size_t> vec_;
104  size_t value_first_; // vec_[index_first_] exists for fast access
105  size_t value_second_; // vec_[index_second_] exists for fast access
106 
107  };
108 
109 }}} // of namespace classifier, yat, and theplu
110 
111 #endif

Generated on Tue Jan 29 2013 02:33:39 for yat by  doxygen 1.8.1