00001 #ifndef CORE_UBLAS_FIXED_MATRIX_H
00002 #define CORE_UBLAS_FIXED_MATRIX_H
00003
00004 #include <core/ublas/fixed_size_array.hpp>
00005 #include <boost/numeric/ublas/matrix.hpp>
00006
00007
00008 namespace boost { namespace numeric { namespace ublas {
00009
00015 template<class T, std::size_t M, std::size_t N, class L = row_major>
00016 class fixed_matrix:
00017 public matrix<T, L, bounded_array<T, M * N> > {
00018
00019 typedef matrix<T, L, bounded_array<T, M * N> > matrix_type;
00020 public:
00022 typedef typename matrix_type::size_type size_type;
00023 static const size_type max_size1 = M;
00024 static const size_type max_size2 = N;
00025 static const size_type dimension1 = M;
00026 static const size_type dimension2 = N;
00027
00028
00029 BOOST_UBLAS_INLINE
00030 fixed_matrix ():
00031 matrix_type (M, N) {}
00032
00033
00034
00035 BOOST_UBLAS_INLINE
00036 fixed_matrix (const fixed_matrix &m):
00037 matrix_type (m) {}
00038 template<class A2>
00039 BOOST_UBLAS_INLINE
00040 fixed_matrix (const matrix<T, L, A2> &m):
00041 matrix_type (m) {}
00042 template<class AE>
00043 BOOST_UBLAS_INLINE
00044 fixed_matrix (const matrix_expression<AE> &ae):
00045 matrix_type (ae) {}
00046 BOOST_UBLAS_INLINE
00047 ~fixed_matrix () {}
00048
00049
00050 BOOST_UBLAS_INLINE
00051 fixed_matrix &operator = (const fixed_matrix &m) {
00052 matrix_type::operator = (m);
00053 return *this;
00054 }
00055 template<class L2, class A2>
00056 BOOST_UBLAS_INLINE
00057 fixed_matrix &operator = (const matrix<T, L2, A2> &m) {
00058 matrix_type::operator = (m);
00059 return *this;
00060 }
00061 template<class C>
00062 BOOST_UBLAS_INLINE
00063 fixed_matrix &operator = (const matrix_container<C> &m) {
00064 matrix_type::operator = (m);
00065 return *this;
00066 }
00067 template<class AE>
00068 BOOST_UBLAS_INLINE
00069 fixed_matrix &operator = (const matrix_expression<AE> &ae) {
00070 matrix_type::operator = (ae);
00071 return *this;
00072 }
00073
00074
00075
00076 void assign(const T & a)
00077 {
00078 for(typename matrix<T, L, bounded_array<T, M * N> >::iterator1 iter1 = matrix<T, L, bounded_array<T, M * N> >::begin1(); iter1 != matrix<T, L, bounded_array<T, M * N> >::end1(); ++iter1)
00079 for(typename matrix<T, L, bounded_array<T, M * N> >::iterator2 iter2 = iter1.begin(); iter2 != iter1.end(); ++iter2)
00080 *iter2 = a;
00081 }
00083 };
00084
00085 }}}
00086
00087 #endif