yat  0.21pre
SVindex.h
1 #ifndef _theplu_yat_classifier_sv_index_
2 #define _theplu_yat_classifier_sv_index_
3 
4 // $Id: SVindex.h 4207 2022-08-26 04:36:28Z peter $
5 
6 /*
7  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2013 Jari Häkkinen
9  Copyright (C) 2022 Peter Johansson
10 
11  This file is part of the yat library, http://dev.thep.lu.se/yat
12 
13  The yat library is free software; you can redistribute it and/or
14  modify it under the terms of the GNU General Public License as
15  published by the Free Software Foundation; either version 3 of the
16  License, or (at your option) any later version.
17 
18  The yat library is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  General Public License for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with yat. If not, see <http://www.gnu.org/licenses/>.
25 */
26 
27 #include <cstddef>
28 #include <vector>
29 
30 namespace theplu {
31 namespace yat {
32 
33 namespace utility {
34  class Vector;
35 }
36 
37 namespace classifier {
38 
46  class SVindex
47  {
48 
49  public:
51  SVindex();
52 
54  SVindex(const size_t);
55 
57  size_t index_first(void) const;
58 
60  size_t index_second(void) const;
61 
63  void init(const utility::Vector& alpha, const double);
64 
66  size_t nof_sv(void) const;
67 
69  void nsv_first(void);
70 
72  void nsv_second(void);
73 
76  void shuffle(void);
77 
79  size_t size(void) const;
80 
82  void sv_first(void);
83 
85  void sv_second(void);
86 
88  void update_first(const size_t i);
89 
91  void update_second(const size_t i);
92 
94  size_t value_first(void) const;
95 
97  size_t value_second(void) const;
98 
100  size_t operator()(size_t i) const;
101 
102  private:
103  size_t index_first_;
104  size_t index_second_;
105  size_t nof_sv_;
106  std::vector<size_t> vec_;
107  size_t value_first_; // vec_[index_first_] exists for fast access
108  size_t value_second_; // vec_[index_second_] exists for fast access
109 
110  };
111 
112 }}} // of namespace classifier, yat, and theplu
113 
114 #endif
size_t value_first(void) const
void update_second(const size_t i)
set index_second to i
The Department of Theoretical Physics namespace as we define it.
Definition: SVindex.h:46
void update_first(const size_t i)
set index_first to i
SVindex()
Default Contructor.
void sv_first(void)
making first to a sv. If already sv, nothing happens.
This is the yat interface to GSL vector.
Definition: Vector.h:59
void init(const utility::Vector &alpha, const double)
synch the object against alpha
void nsv_second(void)
making second to an nsv. If already sv, nothing happens.
size_t operator()(size_t i) const
size_t value_second(void) const
void sv_second(void)
making second to a sv. If already sv, nothing happens.
size_t index_second(void) const
void nsv_first(void)
making first to an nsv. If already sv, nothing happens.
size_t index_first(void) const

Generated on Wed Jan 25 2023 03:34:29 for yat by  doxygen 1.8.14