SHOGUN
v3.2.0
|
00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 2013 Soumyajit De 00008 */ 00009 00010 #ifndef PROBING_SAMPLER_H_ 00011 #define PROBING_SAMPLER_H_ 00012 00013 #include <shogun/lib/config.h> 00014 00015 #ifdef HAVE_COLPACK 00016 #ifdef HAVE_EIGEN3 00017 00018 #include <shogun/mathematics/linalg/ratapprox/tracesampler/TraceSampler.h> 00019 00020 namespace shogun 00021 { 00022 00024 enum EOrderingVariant 00025 { 00026 NATURAL=0, 00027 LARGEST_FIRST, 00028 DYNAMIC_LARGEST_FIRST, 00029 DISTANCE_TWO_LARGEST_FIRST, 00030 SMALLEST_LAST, 00031 DISTANCE_TWO_SMALLEST_LAST, 00032 INCIDENCE_DEGREE, 00033 DISTANCE_TWO_INCIDENCE_DEGREE, 00034 RANDOM 00035 }; 00036 00038 enum EColoringVariant 00039 { 00040 DISTANCE_ONE=0, 00041 ACYCLIC, 00042 ACYCLIC_FOR_INDIRECT_RECOVERY, 00043 STAR, 00044 RESTRICTED_STAR, 00045 DISTANCE_TWO 00046 }; 00047 00048 template<class T> class SGVector; 00049 template<class T> class SGString; 00050 template<class T> class CSparseMatrixOperator; 00051 00056 class CProbingSampler : public CTraceSampler 00057 { 00058 public: 00060 CProbingSampler(); 00061 00071 CProbingSampler(CSparseMatrixOperator<float64_t>* matrix_operator, 00072 int64_t power=1, EOrderingVariant ordering=NATURAL, 00073 EColoringVariant coloring=DISTANCE_TWO); 00074 00076 virtual ~CProbingSampler(); 00077 00082 void set_coloring_vector(SGVector<int32_t> coloring_vector); 00083 00085 SGVector<int32_t> get_coloring_vector() const; 00086 00093 virtual SGVector<float64_t> sample(index_t idx) const; 00094 00096 virtual void precompute(); 00097 00099 virtual const char* get_name() const 00100 { 00101 return "ProbingSampler"; 00102 } 00103 00104 private: 00106 CSparseMatrixOperator<float64_t>* m_matrix_operator; 00107 00109 int64_t m_power; 00110 00112 SGVector<int32_t> m_coloring_vector; 00113 00115 EOrderingVariant m_ordering; 00116 00118 EColoringVariant m_coloring; 00119 00121 bool m_is_precomputed; 00122 00124 void init(); 00125 00126 }; 00127 00128 } 00129 00130 #endif // HAVE_EIGEN3 00131 #endif // HAVE_COLPACK 00132 #endif // PROBING_SAMPLER_H_