yat  0.10.4pre
SVindex.h
1 #ifndef _theplu_yat_classifier_sv_index_
2 #define _theplu_yat_classifier_sv_index_
3 
4 // $Id: SVindex.h 2969 2013-01-23 23:59:44Z peter $
5 
6 /*
7  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2013 Jari Häkkinen
9 
10  This file is part of the yat library, http://dev.thep.lu.se/yat
11 
12  The yat library is free software; you can redistribute it and/or
13  modify it under the terms of the GNU General Public License as
14  published by the Free Software Foundation; either version 3 of the
15  License, or (at your option) any later version.
16 
17  The yat library is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with yat. If not, see <http://www.gnu.org/licenses/>.
24 */
25 
26 #include <cstddef>
27 #include <vector>
28 
29 namespace theplu {
30 namespace yat {
31 
32 namespace utility {
33  class Vector;
34 }
35 
36 namespace classifier {
37 
45  class SVindex
46  {
47 
48  public:
50  SVindex();
51 
53  SVindex(const size_t);
54 
56  size_t index_first(void) const;
57 
59  size_t index_second(void) const;
60 
62  void init(const utility::Vector& alpha, const double);
63 
65  size_t nof_sv(void) const;
66 
68  void nsv_first(void);
69 
71  void nsv_second(void);
72 
75  void shuffle(void);
76 
78  size_t size(void) const;
79 
81  void sv_first(void);
82 
84  void sv_second(void);
85 
87  void update_first(const size_t i);
88 
90  void update_second(const size_t i);
91 
93  size_t value_first(void) const;
94 
96  size_t value_second(void) const;
97 
99  size_t operator()(size_t i) const;
100 
101  private:
102  size_t index_first_;
103  size_t index_second_;
104  size_t nof_sv_;
105  std::vector<size_t> vec_;
106  size_t value_first_; // vec_[index_first_] exists for fast access
107  size_t value_second_; // vec_[index_second_] exists for fast access
108 
109  };
110 
111 }}} // of namespace classifier, yat, and theplu
112 
113 #endif

Generated on Mon Nov 11 2013 09:41:44 for yat by  doxygen 1.8.1