fixed.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_CORE_HPT_FIXED_HPP
13 #define MLPACK_CORE_HPT_FIXED_HPP
14 
15 #include <type_traits>
16 
17 #include <mlpack/core.hpp>
18 
19 namespace mlpack {
20 namespace hpt {
21 
22 template<typename>
23 struct PreFixedArg;
24 
35 template<typename T>
37 {
38  return PreFixedArg<T>{std::forward<T>(value)};
39 }
40 
51 template<typename T, size_t I>
52 struct FixedArg
53 {
55  static const size_t index = I;
56 
58  const T& value;
59 };
60 
70 template<typename T>
71 struct PreFixedArg
72 {
73  using Type = T;
74 
75  const T value;
76 };
77 
84 template<typename T>
85 struct PreFixedArg<T&>
86 {
87  using Type = T;
88 
89  const T& value;
90 };
91 
95 template<typename T>
97 {
98  template<typename>
99  struct Implementation : std::false_type {};
100 
101  template<typename Type>
102  struct Implementation<PreFixedArg<Type>> : std::true_type {};
103 
104  public:
105  static const bool value = Implementation<typename std::decay<T>::type>::value;
106 };
107 
108 } // namespace hpt
109 } // namespace mlpack
110 
111 #endif
PreFixedArg< T > Fixed(T &&value)
Mark the given argument as one that should be fixed.
Definition: fixed.hpp:36
Linear algebra utility functions, generally performed on matrices or vectors.
Include all of the base components required to write mlpack methods, and the main mlpack Doxygen docu...
const T & value
The value of the fixed argument.
Definition: fixed.hpp:58
A struct for marking arguments as ones that should be fixed (it can be useful for the Optimize method...
Definition: fixed.hpp:23
A struct for storing information about a fixed argument.
Definition: fixed.hpp:52
A type function for checking whether the given type is PreFixedArg.
Definition: fixed.hpp:96
static const size_t index
The index of the fixed argument.
Definition: fixed.hpp:55