Algorith sandbox
jacobian_matrix_adaptor.hpp
1 #pragma once
2 #include "algo/ad/detail/jacobian_matrix_adaptor_helper.hpp"
3 #include "algo/ad/iterator/ConstMatrixIterator.hpp"
4 #include "algo/ad/iterator/MatrixIterator.hpp"
5 #include "algo/ad/traits.hpp"
6 #include <boost/numeric/ublas/fwd.hpp>
7 #include <boost/numeric/ublas/matrix_expression.hpp>
8 #include <boost/numeric/ublas/matrix_expression.hpp>
9 
10 namespace algo { namespace ad {
16  template <typename E>
18  : public boost::numeric::ublas::matrix_expression<jacobian_matrix_adaptor<E> > {
19  //private typedef
20  private:
22  typedef typename E::const_closure_type expression_const_closure_type;
23  //public typedef
24  public:
25  typedef std::size_t size_type;
26  typedef double value_type;
27  typedef std::ptrdiff_t difference_type;
28  typedef const self_type const_closure_type;
31  typedef boost::numeric::ublas::unknown_orientation_tag orientation_category;
32  //public function
33  public:
34  explicit jacobian_matrix_adaptor(const E& e)
35  : _e(e)
36  {
37  }
43  size_type size1() const
44  {
45  return _e.size();
46  }
52  size_type size2() const
53  {
54  return _e(0).getDerivative().size();
55  }
64  const double operator()(size_type i, size_type j) const
65  {
66  return detail::jacobian_matrix_accessor(_e, i, j);
67  }
68  //private function
69  private:
70  //private members
71  private:
72  expression_const_closure_type _e;
73  };
74 } } // namespace algo { namespace ad {
75 
const double operator()(size_type i, size_type j) const
Definition: jacobian_matrix_adaptor.hpp:64
size_type size1() const
row size.
Definition: jacobian_matrix_adaptor.hpp:43
Definition: ConstMatrixIterator.hpp:6
Definition: ublas_matrix_expression_concept.hpp:5
size_type size2() const
col size. Currently, we assume _e is vecor.
Definition: jacobian_matrix_adaptor.hpp:52
must be const.
Definition: jacobian_matrix_adaptor.hpp:17