SHOGUN  v3.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ProbingSampler.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) 2013 Soumyajit De
8  */
9 
10 #ifndef PROBING_SAMPLER_H_
11 #define PROBING_SAMPLER_H_
12 
13 #include <shogun/lib/config.h>
14 
15 #ifdef HAVE_COLPACK
16 #ifdef HAVE_EIGEN3
17 
19 
20 namespace shogun
21 {
22 
24 enum EOrderingVariant
25 {
26  NATURAL=0,
27  LARGEST_FIRST,
28  DYNAMIC_LARGEST_FIRST,
29  DISTANCE_TWO_LARGEST_FIRST,
30  SMALLEST_LAST,
31  DISTANCE_TWO_SMALLEST_LAST,
32  INCIDENCE_DEGREE,
33  DISTANCE_TWO_INCIDENCE_DEGREE,
34  RANDOM
35 };
36 
38 enum EColoringVariant
39 {
40  DISTANCE_ONE=0,
41  ACYCLIC,
42  ACYCLIC_FOR_INDIRECT_RECOVERY,
43  STAR,
44  RESTRICTED_STAR,
45  DISTANCE_TWO
46 };
47 
48 template<class T> class SGVector;
49 template<class T> class SGString;
50 template<class T> class CSparseMatrixOperator;
51 
56 class CProbingSampler : public CTraceSampler
57 {
58 public:
60  CProbingSampler();
61 
71  CProbingSampler(CSparseMatrixOperator<float64_t>* matrix_operator,
72  int64_t power=1, EOrderingVariant ordering=NATURAL,
73  EColoringVariant coloring=DISTANCE_TWO);
74 
76  virtual ~CProbingSampler();
77 
79  SGVector<int32_t> get_coloring_vector() const;
80 
87  virtual SGVector<float64_t> sample(index_t idx) const;
88 
90  virtual void precompute();
91 
93  virtual const char* get_name() const
94  {
95  return "ProbingSampler";
96  }
97 
98 private:
100  CSparseMatrixOperator<float64_t>* m_matrix_operator;
101 
103  int64_t m_power;
104 
106  SGVector<int32_t> m_coloring_vector;
107 
109  SGString<char> m_ordering;
110 
112  SGString<char> m_coloring;
113 
115  void init();
116 
117 };
118 
119 }
120 
121 #endif // HAVE_EIGEN3
122 #endif // HAVE_COLPACK
123 #endif // PROBING_SAMPLER_H_

SHOGUN Machine Learning Toolbox - Documentation