SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
nloptcommon.h
Go to the documentation of this file.
1 #ifndef NLOPTCOMMON_H
2 #define NLOPTCOMMON_H
3 
4 #include <shogun/lib/config.h>
5 #include <shogun/lib/common.h>
6 #include <shogun/io/SGIO.h>
7 
8 #ifdef USE_GPL_SHOGUN
9 #ifdef HAVE_NLOPT
10 #include <nlopt.h>
11 #endif
12 
13 namespace shogun
14 {
15 
16 #ifdef HAVE_NLOPT
17 #ifndef DOXYGEN_SHOULD_SKIP_THIS
18 struct NLOPTAlgorithmHelper
19 {
20  static int16_t get_nlopt_algorithm_id(nlopt_algorithm method)
21  {
22  return (int16_t) method;
23  }
24 
25  static nlopt_algorithm get_nlopt_algorithm(int16_t method_id)
26  {
27  REQUIRE(method_id>=0 && method_id<(int16_t)NLOPT_NUM_ALGORITHMS,
28  "Unsupported method id (%d)\n", method_id);
29  return (nlopt_algorithm) method_id;
30  }
31 };
32 #endif
33 #endif //HAVE_NLOPT
34 
35 } // namespace shogun
36 
37 #endif //USE_GPL_SHOGUN
38 #endif //NLOPTCOMMON_H
#define REQUIRE(x,...)
Definition: SGIO.h:206
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18

SHOGUN Machine Learning Toolbox - Documentation