NiHu  2.0
matrix_traits.hpp
Go to the documentation of this file.
1 #ifndef MATRIX_TRAITS_HPP_INCLUDED
4 #define MATRIX_TRAITS_HPP_INCLUDED
5 
6 #include <complex>
7 
8 namespace NiHu
9 {
10 
15 template <class T>
16 struct num_rows
17 {
18  static int const value = T::RowsAtCompileTime;
19 };
20 
22 template <>
23 struct num_rows<double>
24 {
25  static int const value = 1;
26 };
27 
29 template <>
30 struct num_rows<std::complex<double> >
31 {
32  static int const value = 1;
33 };
34 
35 
40 template <class T>
41 struct num_cols
42 {
43  static int const value = T::ColsAtCompileTime;
44 };
45 
47 template <>
48 struct num_cols<double>
49 {
50  static int const value = 1;
51 };
52 
54 template <>
55 struct num_cols<std::complex<double> >
56 {
57  static int const value = 1;
58 };
59 
60 
65 template <class T>
66 struct scalar
67 {
68  typedef typename T::Scalar type;
69 };
70 
71 
73 template <>
74 struct scalar<double>
75 {
76  typedef double type;
77 };
78 
79 
81 template <>
82 struct scalar<std::complex<double> >
83 {
84  typedef std::complex<double> type;
85 };
86 
87 } // namespace NiHu
88 
89 #endif // MATRIX_TRAITS_HPP_INCLUDED
NiHu::scalar
metafunction returning the scalar type
Definition: matrix_traits.hpp:66
NiHu::num_rows
metafunction returning the number of compile time rows
Definition: matrix_traits.hpp:16
NiHu::num_cols
metafunction returning the number of compile time columns
Definition: matrix_traits.hpp:41