21 #ifndef RFFGEN_LINEAR_ALGEBRA_EXTRACTROWSANDCOLS_HH
22 #define RFFGEN_LINEAR_ALGEBRA_EXTRACTROWSANDCOLS_HH
24 #include <type_traits>
31 namespace Concepts {
template <
class>
struct MatrixConceptCheck; }
36 namespace LinearAlgebra
39 template <
class Matrix ,
class = Concepts::MatrixConceptCheck<Matrix> >
struct NumberOfRows : std::integral_constant<int,-1> {};
42 template <
class Matrix ,
class = Concepts::MatrixConceptCheck<Matrix> >
struct NumberOfColumns : std::integral_constant<int,-1> {};
48 template <
template <
class,int,
int...>
class Matrix,
class T,
int n,
class MatrixConceptCheck,
int... m>
49 struct NumberOfRows< Matrix<T,n,m...> , MatrixConceptCheck > : std::integral_constant<int,n> {};
52 template <
template <
class,
unsigned,
unsigned>
class Matrix,
class T,
unsigned n,
unsigned m,
class MatrixConceptCheck>
53 struct NumberOfRows< Matrix<T,n,m> , MatrixConceptCheck > : std::integral_constant<unsigned,n> {};
56 template <
template <
int,
int>
class Matrix,
int n,
int m,
class MatrixConceptCheck>
57 struct NumberOfRows< Matrix<n,m> , MatrixConceptCheck > : std::integral_constant<int,n> {};
60 template <
template <
unsigned,
unsigned>
class Matrix,
unsigned n,
unsigned m,
class MatrixConceptCheck>
61 struct NumberOfRows< Matrix<n,m> , MatrixConceptCheck > : std::integral_constant<unsigned,n> {};
65 template <
template <
class,
int>
class Vector,
class T,
int n,
class MatrixConceptCheck>
66 struct NumberOfRows< Vector<T,n> , MatrixConceptCheck > : std::integral_constant<int,n> {};
69 template <
template <
class,
unsigned>
class Vector,
class T,
unsigned n,
class MatrixConceptCheck>
70 struct NumberOfRows< Vector<T,n> , MatrixConceptCheck > : std::integral_constant<unsigned,n> {};
73 template <
template <
int>
class Vector,
int n,
class MatrixConceptCheck>
74 struct NumberOfRows< Vector<n> , MatrixConceptCheck > : std::integral_constant<int,n> {};
77 template <
template <
unsigned>
class Vector,
unsigned n,
class MatrixConceptCheck>
78 struct NumberOfRows< Vector<n> , MatrixConceptCheck > : std::integral_constant<unsigned,n> {};
82 template <
template <
class,
int,
int>
class Matrix,
class T,
int n,
int m,
class MatrixConceptCheck>
83 struct NumberOfColumns< Matrix<T,n,m> , MatrixConceptCheck > : std::integral_constant<int,m> {};
86 template <
template <
class,int,int,
int...>
class Matrix,
class T,
int n,
int m,
class MatrixConceptCheck,
int... other>
87 struct NumberOfColumns< Matrix<T,n,m,other...> , MatrixConceptCheck > : std::integral_constant<int,m> {};
90 template <
template <
class,
unsigned,
unsigned>
class Matrix,
class T,
unsigned n,
unsigned m,
class MatrixConceptCheck>
91 struct NumberOfColumns< Matrix<T,n,m> , MatrixConceptCheck > : std::integral_constant<unsigned,m> {};
95 template <
template <
int,
int>
class Matrix,
int n,
int m,
class MatrixConceptCheck>
96 struct NumberOfColumns< Matrix<n,m> , MatrixConceptCheck > : std::integral_constant<int,m> {};
99 template <
template <
unsigned,
unsigned>
class Matrix,
unsigned n,
unsigned m,
class MatrixConceptCheck>
100 struct NumberOfColumns< Matrix<n,m> , MatrixConceptCheck > : std::integral_constant<unsigned,m> {};
104 template <
class Matrix>
105 constexpr
int numberOfRows()
107 return NumberOfRows<Matrix>::value;
111 template <
class Matrix>
112 constexpr
int numberOfColumns()
114 return NumberOfColumns<Matrix>::value;
119 #endif // RFFGEN_LINEAR_ALGEBRA_EXTRACTROWSANDCOLS_HH
Specialize this for your matrix class. Number of columns must be provided by a static member variable...
Definition: extractRowsAndCols.hh:42
Specialize this for your matrix class. Number of rows must be provided by a static member variable ca...
Definition: extractRowsAndCols.hh:39