CMR  1.3.0
matrix_modified.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <boost/numeric/ublas/matrix_expression.hpp>
4 
5 namespace tu
6 {
7 
12  template <typename MatrixType, typename ModifierType>
13  class matrix_modified: public boost::numeric::ublas::matrix_expression <matrix_modified <MatrixType, ModifierType> >
14  {
15  public:
17  typedef MatrixType matrix_type;
18  typedef typename MatrixType::size_type size_type;
19  typedef typename MatrixType::difference_type difference_type;
20  typedef typename ModifierType::value_type value_type;
21  typedef typename MatrixType::const_reference const_reference;
22  typedef typename MatrixType::const_reference reference;
23  typedef typename MatrixType::const_closure_type matrix_closure_type;
26 
27  typedef ModifierType modifier_type;
28 
29  private:
30  const matrix_type& _data;
31  modifier_type& _modifier;
32 
33  public:
34 
42  matrix_modified(const MatrixType& matrix, modifier_type& modifier) :
43  _data(matrix), _modifier(modifier)
44  {
45 
46  }
47 
52  inline size_type size1() const
53  {
54  return _data.size1();
55  }
56 
61  inline size_type size2() const
62  {
63  return _data.size2();
64  }
65 
70  inline MatrixType& data()
71  {
72  return _data;
73  }
74 
80  {
81  return _modifier;
82  }
83 
93  {
94  return _modifier(i, j, _data(i, j));
95  }
96 
97  };
98 
99 } /* namespace tu */
Definition: matrix_modified.hpp:14
ModifierType modifier_type
Definition: matrix_modified.hpp:27
MatrixType & data()
Definition: matrix_modified.hpp:70
size_type size1() const
Definition: matrix_modified.hpp:52
MatrixType::const_reference const_reference
Definition: matrix_modified.hpp:21
const self_type const_closure_type
Definition: matrix_modified.hpp:24
MatrixType::size_type size_type
Definition: matrix_modified.hpp:18
MatrixType::const_reference reference
Definition: matrix_modified.hpp:22
MatrixType matrix_type
Definition: matrix_modified.hpp:17
self_type closure_type
Definition: matrix_modified.hpp:25
MatrixType::difference_type difference_type
Definition: matrix_modified.hpp:19
matrix_modified< MatrixType, ModifierType > self_type
Definition: matrix_modified.hpp:16
size_type size2() const
Definition: matrix_modified.hpp:61
ModifierType::value_type value_type
Definition: matrix_modified.hpp:20
modifier_type & modifier()
Definition: matrix_modified.hpp:79
MatrixType::const_closure_type matrix_closure_type
Definition: matrix_modified.hpp:23
value_type operator()(size_type i, size_type j) const
Definition: matrix_modified.hpp:92
matrix_modified(const MatrixType &matrix, modifier_type &modifier)
Definition: matrix_modified.hpp:42
Definition: algorithm.hpp:14