34 #ifndef __VMML_MATRIX_TRAITS_HPP__
35 #define __VMML_MATRIX_TRAITS_HPP__
37 #include <vmmlib/matrix.hpp>
38 #include <boost/la/matrix_traits.hpp>
45 template<
size_t M,
size_t N,
typename T>
46 struct matrix_traits<vmml::matrix<M, N, T> >
50 static const int rows = M;
51 static const int cols = N;
53 typedef T scalar_type;
55 template<
int Row,
int Col>
58 BOOST_STATIC_ASSERT(Row >= 0);
59 BOOST_STATIC_ASSERT(Row < rows);
60 BOOST_STATIC_ASSERT(Col >= 0);
61 BOOST_STATIC_ASSERT(Col < cols);
62 return m.at(Col, Row);
65 template<
int Row,
int Col>
68 BOOST_STATIC_ASSERT(Row >= 0);
69 BOOST_STATIC_ASSERT(Row < rows);
70 BOOST_STATIC_ASSERT(Col >= 0);
71 BOOST_STATIC_ASSERT(Col < cols);
72 return m.at(Col, Row);
75 static scalar_type ir(
int row,
int col,
const matrix_type& m)
77 BOOST_ASSERT(row >= 0);
78 BOOST_ASSERT(row < rows);
79 BOOST_ASSERT(col >= 0);
80 BOOST_ASSERT(col < cols);
81 return m.at(col, row);
84 static scalar_type& iw(
int row,
int col,
matrix_type& m)
86 BOOST_ASSERT(row >= 0);
87 BOOST_ASSERT(row < rows);
88 BOOST_ASSERT(col >= 0);
89 BOOST_ASSERT(col < cols);
90 return m.at(col, row);