arma_traits.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_CORE_UTIL_ARMA_TRAITS_HPP
13 #define MLPACK_CORE_UTIL_ARMA_TRAITS_HPP
14 
15 // Structs have public members by default (that's why they are chosen over
16 // classes).
17 
34 template<typename VecType>
35 struct IsVector
36 {
37  const static bool value = false;
38 };
39 
40 // Commenting out the first template per case, because
41 // Visual Studio doesn't like this instantiaion pattern (error C2910).
42 // template<>
43 template<typename eT>
44 struct IsVector<arma::Col<eT> >
45 {
46  const static bool value = true;
47 };
48 
49 // template<>
50 template<typename eT>
51 struct IsVector<arma::SpCol<eT> >
52 {
53  const static bool value = true;
54 };
55 
56 // template<>
57 template<typename eT>
58 struct IsVector<arma::Row<eT> >
59 {
60  const static bool value = true;
61 };
62 
63 // template<>
64 template<typename eT>
65 struct IsVector<arma::SpRow<eT> >
66 {
67  const static bool value = true;
68 };
69 
70 // template<>
71 template<typename eT>
72 struct IsVector<arma::subview_col<eT> >
73 {
74  const static bool value = true;
75 };
76 
77 // template<>
78 template<typename eT>
79 struct IsVector<arma::subview_row<eT> >
80 {
81  const static bool value = true;
82 };
83 
84 
85 #if ((ARMA_VERSION_MAJOR >= 10) || \
86  ((ARMA_VERSION_MAJOR == 9) && (ARMA_VERSION_MINOR >= 869)))
87 
88  // Armadillo 9.869+ has SpSubview_col and SpSubview_row
89 
90  template<typename eT>
91  struct IsVector<arma::SpSubview_col<eT> >
92  {
93  const static bool value = true;
94  };
95 
96  template<typename eT>
97  struct IsVector<arma::SpSubview_row<eT> >
98  {
99  const static bool value = true;
100  };
101 
102 #else
103 
104  // fallback for older Armadillo versions
105 
106  template<typename eT>
107  struct IsVector<arma::SpSubview<eT> >
108  {
109  const static bool value = true;
110  };
111 
112 #endif
113 
114 #endif
static const bool value
Definition: arma_traits.hpp:37
If value == true, then VecType is some sort of Armadillo vector or subview.
Definition: arma_traits.hpp:35