21 #ifndef RFFGEN_LINEAR_ALGEBRA_ROWS_AND_COLS_HH
22 #define RFFGEN_LINEAR_ALGEBRA_ROWS_AND_COLS_HH
25 #include "extractRowsAndCols.hh"
26 #include "../Util/staticChecks_nRows_nCols.hh"
27 #include "../Util/staticChecks.hh"
31 namespace LinearAlgebra
38 template <
class Matrix,
bool accessViaRows,
bool accessVia_n_rows>
struct Rows;
40 template <
class Matrix ,
bool accessVia_n_rows >
41 struct Rows<Matrix,true,accessVia_n_rows>
43 auto operator()(
const Matrix& A)
const
49 template <
class Matrix >
50 struct Rows<Matrix,false,true>
52 const auto& operator()(
const Matrix& A)
const noexcept
58 template <
class Matrix,
bool accessViaCols,
bool accessVia_n_cols>
struct Cols;
60 template <
class Matrix ,
bool accessVia_n_cols >
61 struct Cols<Matrix,true,accessVia_n_cols>
63 auto operator()(
const Matrix& A)
const
69 template <
class Matrix >
70 struct Cols<Matrix,false,true>
72 const auto& operator()(
const Matrix& A)
const noexcept
85 template <
class Matrix ,
86 class = std::enable_if_t<!Checks::isConstantSizeMatrix<Matrix>()> ,
87 class = std::enable_if_t<Checks::isDynamicMatrix<Matrix>()> >
88 auto rows(
const Matrix& A)
90 return Detail::Rows<Matrix,Checks::hasRowsFunction<Matrix>(),Checks::hasMember_n_rows<Matrix>()>()(A);
96 template <
class Matrix ,
97 class = std::enable_if_t<Checks::isConstantSizeMatrix<Matrix>()> >
100 return numberOfRows<Matrix>();
106 template <
class Matrix ,
107 class = std::enable_if_t<!Checks::isConstantSizeMatrix<Matrix>()> ,
108 class = std::enable_if_t<Checks::isDynamicMatrix<Matrix>()> >
109 auto cols(
const Matrix& A)
111 return Detail::Cols<Matrix,Checks::hasColsFunction<Matrix>(),Checks::hasMember_n_cols<Matrix>()>()(A);
117 template <
class Matrix ,
118 class = std::enable_if_t<Checks::isConstantSizeMatrix<Matrix>()> >
119 constexpr
auto cols()
121 return numberOfColumns<Matrix>();
126 #endif // RFFGEN_LINEAR_ALGEBRA_ROWS_AND_COLS_HH