WaveBlocksND
hessian.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../../types.hpp"
4 #include "../../utilities/evaluations.hpp"
5 
6 #include "../bases.hpp"
7 
8 
9 namespace waveblocks
10 {
11  namespace potentials
12  {
13  namespace modules
14  {
15  namespace hessian
16  {
29  template <class Subtype, class Basis>
30  struct Abstract {
32  IMPORT_TYPES_FROM( Basis)
33 
34 
35  hessian_evaluation_type evaluate_hessian_at( const argument_type &arg ) const {
36  return static_cast<const Subtype*>(this)->evaluate_hessian_at_implementation( arg );
37  }
38 
39  template < template <typename...> class grid_in = std::vector,
40  template <typename...> class grid_out = grid_in >
41  grid_out<hessian_evaluation_type> evaluate_hessian(
42  const grid_in<argument_type > &args ) const {
43  return utilities::evaluate_function_in_grid < argument_type,
44  hessian_evaluation_type,
45  grid_in,
46  grid_out,
47  function_t > (
48  std::bind( &Self::evaluate_hessian_at, this, std::placeholders::_1 ),
49  args );
50  }
51 
52  };
53 
62  template <class Basis>
63  struct Standard : Abstract<Standard<Basis>, Basis> {
64 
65  IMPORT_TYPES_FROM( Basis)
66 
67  private:
68  hessian_type hessian;
69 
70  public:
72  hessian_type hessian )
73  : hessian( hessian ){}
74 
75  public:
76 
77 
78  hessian_evaluation_type evaluate_hessian_at_implementation(
79  const argument_type &arg ) const {
80  return utilities::FunctionMatrixEvaluator< Basis::number_of_levels,
81  Basis::number_of_columns,
82  GMatrix,
83  argument_type,
84  hessian_return_type,
85  function_t >::apply( hessian, arg );
86  }
87  };
88 
89 
90 
91  }
92 
93  template <class Basis>
95  }
96  }
97 }
Definition: coefficients_file_parser.cpp:10
Abstract class for potential evaluation.
Definition: hessian.hpp:30
G_out< R > evaluate_function_in_grid(const F< R(A)> &f, const G_in< A > &g)
Evaluate a function in multiple points at once.
Definition: evaluations.hpp:130
Eigen::Matrix< I, R, C > GMatrix
Definition: types.hpp:37
hessian_evaluation_type evaluate_hessian_at_implementation(const argument_type &arg) const
Definition: hessian.hpp:78
Standard(hessian_type hessian)
Definition: hessian.hpp:71
hessian_evaluation_type evaluate_hessian_at(const argument_type &arg) const
Definition: hessian.hpp:35
std::function< P > function_t
Definition: types.hpp:57
#define IMPORT_TYPES_FROM(B)
Definition: bases.hpp:3
grid_out< hessian_evaluation_type > evaluate_hessian(const grid_in< argument_type > &args) const
Definition: hessian.hpp:41
hessian_type hessian
Definition: hessian.hpp:68
Helper class for easier template specialization.
Definition: hessian.hpp:63