SHOGUN  4.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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 
82  void set_coloring_vector(SGVector<int32_t> coloring_vector);
83 
85  SGVector<int32_t> get_coloring_vector() const;
86 
93  virtual SGVector<float64_t> sample(index_t idx) const;
94 
96  virtual void precompute();
97 
99  virtual const char* get_name() const
100  {
101  return "ProbingSampler";
102  }
103 
104 private:
106  CSparseMatrixOperator<float64_t>* m_matrix_operator;
107 
109  int64_t m_power;
110 
112  SGVector<int32_t> m_coloring_vector;
113 
115  EOrderingVariant m_ordering;
116 
118  EColoringVariant m_coloring;
119 
121  bool m_is_precomputed;
122 
124  void init();
125 
126 };
127 
128 }
129 
130 #endif // HAVE_EIGEN3
131 #endif // HAVE_COLPACK
132 #endif // PROBING_SAMPLER_H_
int32_t index_t
Definition: common.h:62
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18

SHOGUN Machine Learning Toolbox - Documentation