SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Subset.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2011 Heiko Strathmann
8  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
9  */
10 
11 #ifndef __SUBSET_H_
12 #define __SUBSET_H_
13 
14 #include <shogun/base/SGObject.h>
15 
16 namespace shogun
17 {
18 
24 class CSubset: public CSGObject
25 {
26 public:
28  CSubset();
29 
34  CSubset(SGVector<index_t> subset_idx);
35 
37  virtual ~CSubset();
38 
40  inline const char* get_name() const { return "Subset"; }
41 
45  inline const index_t get_size() const { return m_subset_idx.vlen; }
46 
48  CSubset* duplicate();
49 
56  {
57  return m_subset_idx.vector ? m_subset_idx.vector[idx] : idx;
58  }
59 private:
60  void init();
61 
62 private:
63  const SGVector<index_t> m_subset_idx;
64 };
65 
66 }
67 #endif /* __SUBSET_H_ */

SHOGUN Machine Learning Toolbox - Documentation