00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef MTL_STATIC_NUM_ROWS_INCLUDE
00013 #define MTL_STATIC_NUM_ROWS_INCLUDE
00014
00015 #include <boost/mpl/bool.hpp>
00016 #include <boost/numeric/mtl/mtl_fwd.hpp>
00017 #include <boost/numeric/mtl/utility/is_row_major.hpp>
00018 #include <boost/numeric/mtl/matrix/dimension.hpp>
00019 #include <boost/numeric/mtl/vector/dimension.hpp>
00020
00021 namespace mtl {
00022
00024
00025 template <typename Collection>
00026 struct static_num_rows {
00027
00028
00029 };
00030
00031
00033 template <typename Value, unsigned Size>
00034 struct static_num_rows<Value[Size]>
00035 {
00036 typedef std::size_t type;
00037 static const type value= Size;
00038 };
00039
00041 template <typename Value, unsigned Rows, unsigned Cols>
00042 struct static_num_rows<Value[Rows][Cols]>
00043 {
00044 typedef std::size_t type;
00045 static const type value= Rows;
00046 };
00047
00048
00049 template <std::size_t Size>
00050 struct static_num_rows< vector::fixed::dimension<Size> >
00051 {
00052 typedef std::size_t type;
00053 static const type value= Size;
00054 };
00055
00056 template <typename V, typename P>
00057 struct static_num_rows<mtl::vector::dense_vector<V, P> >
00058 {
00059 typedef std::size_t type;
00060 static const type value= traits::is_row_major<P>::value ? 1 : static_num_rows<typename P::dimension>::value;
00061 };
00062
00063
00064 template <std::size_t Rows, std::size_t Cols>
00065 struct static_num_rows< fixed::dimensions<Rows, Cols> >
00066 {
00067 typedef std::size_t type;
00068 static const type value= Rows;
00069 };
00070
00071 template <typename V, typename P>
00072 struct static_num_rows<mtl::matrix::dense2D<V, P> >
00073 : static_num_rows<typename P::dimensions>
00074 {};
00075
00076 template <typename V, unsigned long M, typename P>
00077 struct static_num_rows<mtl::matrix::morton_dense<V, M, P> >
00078 : static_num_rows<typename P::dimensions>
00079 {};
00080
00081 template <typename V, typename P>
00082 struct static_num_rows<mtl::matrix::compressed2D<V, P> >
00083 : static_num_rows<typename P::dimensions>
00084 {};
00085
00086 }
00087
00088 #endif // MTL_STATIC_NUM_ROWS_INCLUDE