Tapkee
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
defines/methods.hpp
Go to the documentation of this file.
1 /* This software is distributed under BSD 3-clause license (see LICENSE file).
2  *
3  * Copyright (c) 2012-2013 Sergey Lisitsyn
4  */
5 
6 #ifndef TAPKEE_DEFINES_METHODS_H_
7 #define TAPKEE_DEFINES_METHODS_H_
8 
9 namespace tapkee
10 {
13  {
57  PCA,
72  };
73 
74 #ifndef DOXYGEN_SHOULD_SKIP_THIS
75  // Methods identification
96 #endif // DOXYGEN_SHOULD_SKIP_THS
97 
98  template <typename M>
99  struct Method
100  {
101  Method(const char* n) : name_(n)
102  {
103  }
104  Method(const M& m) : name_(m.name_)
105  {
106  }
108  {
109  this->name_ = m.name_;
110  return *this;
111  }
112  const char* name() const
113  {
114  return name_;
115  }
116  bool is(const M& m) const
117  {
118  return this->name()==m.name();
119  }
120  bool operator==(const M& m)
121  {
122  return this->name()==m.name();
123  }
124  const char* name_;
125  };
126 
127  struct NeighborsMethod : public Method<NeighborsMethod>
128  {
130  {
131  }
132  };
133 
137  static const NeighborsMethod Brute("Brute-force");
139  static const NeighborsMethod VpTree("Vantage point tree");
140 #ifdef TAPKEE_USE_LGPL_COVERTREE
141  static const NeighborsMethod CoverTree("Cover tree");
144 #endif
145 
146 #ifdef TAPKEE_USE_LGPL_COVERTREE
148 #else
150 #endif
151 
152  struct EigenMethod : public Method<EigenMethod>
153  {
154  EigenMethod(const char* n) : Method<EigenMethod>(n)
155  {
156  }
157  };
158 
159 #ifdef TAPKEE_WITH_ARPACK
160  static const EigenMethod Arpack("Arpack");
164 #endif
165  static const EigenMethod Randomized("Randomized");
170  static const EigenMethod Dense("Dense");
171 
172 #ifdef TAPKEE_WITH_ARPACK
174 #else
176 #endif
177 
178  struct ComputationStrategy : public Method<ComputationStrategy>
179  {
181  {
182  }
183  };
184 
185 #ifdef TAPKEE_WITH_VIENNACL
186  static const ComputationStrategy HeterogeneousOpenCLStrategy("OpenCL");
187 #endif
188  static const ComputationStrategy HomogeneousCPUStrategy("CPU");
189 
191 
192  namespace tapkee_internal
193  {
194 
195  struct EigendecompositionStrategy : public Method<EigendecompositionStrategy>
196  {
198  skip_(skp)
199  {
200  }
201  IndexType skip() const
202  {
203  return skip_;
204  }
206  };
207 
208  static const EigendecompositionStrategy LargestEigenvalues("Largest eigenvalues", 0);
209  static const EigendecompositionStrategy SquaredLargestEigenvalues("Largest eigenvalues of squared matrix", 0);
210  static const EigendecompositionStrategy SmallestEigenvalues("Smallest eigenvalues", 1);
211 
212  }
213 
214 }
215 
216 #endif
217 
static const EigenMethod Dense("Dense")
Eigen library dense method (could be useful for debugging). Computes all eigenvectors thus can be ver...
static const EigendecompositionStrategy SmallestEigenvalues("Smallest eigenvalues", 1)
static const EigenMethod Randomized("Randomized")
Randomized method (implementation taken from the redsvd lib). Supports only standard but not generali...
#define METHOD_THAT_NEEDS_ONLY_DISTANCE_IS(X)
static const EigendecompositionStrategy SquaredLargestEigenvalues("Largest eigenvalues of squared matrix", 0)
bool operator==(const M &m)
static const NeighborsMethod Brute("Brute-force")
Brute force method with not least than time complexity. Recommended to be used only in debug purpose...
static EigenMethod default_eigen_method
#define METHOD_THAT_NEEDS_DISTANCE_AND_FEATURES_IS(X)
EigendecompositionStrategy(const char *n, IndexType skp)
Method & operator=(const Method &m)
static const EigenMethod Arpack("Arpack")
ARPACK-based method (requires the ARPACK library binaries to be available around). Recommended to be used as a default method. Supports both generalized and standard eigenproblems.
Method(const M &m)
#define METHOD_THAT_NEEDS_ONLY_KERNEL_IS(X)
const char * name() const
int IndexType
indexing type (non-overridable) set to int for compatibility with OpenMP 2.0
Definition: types.hpp:19
DimensionReductionMethod
Dimension reduction methods.
NeighborsMethod(const char *n)
static const ComputationStrategy HomogeneousCPUStrategy("CPU")
const char * name_
EigenMethod(const char *n)
bool is(const M &m) const
static ComputationStrategy default_computation_strategy
#define METHOD_THAT_NEEDS_NOTHING_IS(X)
static const EigendecompositionStrategy LargestEigenvalues("Largest eigenvalues", 0)
#define METHOD_THAT_NEEDS_KERNEL_AND_FEATURES_IS(X)
#define METHOD_THAT_NEEDS_ONLY_FEATURES_IS(X)
Method(const char *n)
static NeighborsMethod default_neighbors_method
static const NeighborsMethod VpTree("Vantage point tree")
Vantage point tree -based method.
static const NeighborsMethod CoverTree("Cover tree")
Covertree-based method with approximate time complexity. Recommended to be used as a default method...