mlpack 3.4.2
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
34template<typename VecType>
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<>
43template<typename eT>
44struct IsVector<arma::Col<eT> >
45{
46 const static bool value = true;
47};
48
49// template<>
50template<typename eT>
51struct IsVector<arma::SpCol<eT> >
52{
53 const static bool value = true;
54};
55
56// template<>
57template<typename eT>
58struct IsVector<arma::Row<eT> >
59{
60 const static bool value = true;
61};
62
63// template<>
64template<typename eT>
65struct IsVector<arma::SpRow<eT> >
66{
67 const static bool value = true;
68};
69
70// template<>
71template<typename eT>
72struct IsVector<arma::subview_col<eT> >
73{
74 const static bool value = true;
75};
76
77// template<>
78template<typename eT>
79struct 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
If value == true, then VecType is some sort of Armadillo vector or subview.
Definition: arma_traits.hpp:36
static const bool value
Definition: arma_traits.hpp:37