1 #ifndef BOOST_QVM_MAT_HPP_INCLUDED
2 #define BOOST_QVM_MAT_HPP_INCLUDED
4 // Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc.
6 // Distributed under the Boost Software License, Version 1.0. (See accompanying
7 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 #include <boost/qvm/detail/mat_assign.hpp>
10 #include <boost/qvm/assert.hpp>
11 #include <boost/qvm/static_assert.hpp>
13 namespace boost { namespace qvm {
15 template <class T,int Rows,int Cols>
32 template <class T,int Rows,int Cols>
34 mat_traits< mat<T,Rows,Cols> >
36 typedef mat<T,Rows,Cols> this_matrix;
37 typedef T scalar_type;
38 static int const rows=Rows;
39 static int const cols=Cols;
41 template <int Row,int Col>
43 BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_CRITICAL
45 read_element( this_matrix const & x )
47 BOOST_QVM_STATIC_ASSERT(Row>=0);
48 BOOST_QVM_STATIC_ASSERT(Row<Rows);
49 BOOST_QVM_STATIC_ASSERT(Col>=0);
50 BOOST_QVM_STATIC_ASSERT(Col<Cols);
54 template <int Row,int Col>
56 BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_CRITICAL
58 write_element( this_matrix & x )
60 BOOST_QVM_STATIC_ASSERT(Row>=0);
61 BOOST_QVM_STATIC_ASSERT(Row<Rows);
62 BOOST_QVM_STATIC_ASSERT(Col>=0);
63 BOOST_QVM_STATIC_ASSERT(Col<Cols);
68 BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_CRITICAL
70 read_element_idx( int row, int col, this_matrix const & x )
72 BOOST_QVM_ASSERT(row>=0);
73 BOOST_QVM_ASSERT(row<Rows);
74 BOOST_QVM_ASSERT(col>=0);
75 BOOST_QVM_ASSERT(col<Cols);
80 BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_CRITICAL
82 write_element_idx( int row, int col, this_matrix & x )
84 BOOST_QVM_ASSERT(row>=0);
85 BOOST_QVM_ASSERT(row<Rows);
86 BOOST_QVM_ASSERT(col>=0);
87 BOOST_QVM_ASSERT(col<Cols);