1 #ifndef GAUDIMATH_FUNADAPTERS_H 2 #define GAUDIMATH_FUNADAPTERS_H 1 6 #include <boost/variant.hpp> 11 #include "CLHEP/GenericFunctions/AbsFunction.hh" 12 #include "CLHEP/GenericFunctions/Argument.hh" 13 #include "CLHEP/GenericFunctions/GenericFunctions.hh" 17 #if defined( __clang__ ) || defined( __CLING__ ) 18 #pragma clang diagnostic push 19 #pragma clang diagnostic ignored "-Winconsistent-missing-override" 20 #elif defined( __GNUC__ ) && __GNUC__ >= 5 21 #pragma GCC diagnostic push 22 #pragma GCC diagnostic ignored "-Wsuggest-override" 27 #if __cplusplus > 201402L 30 template <
typename... lambda_ts>
31 struct composer_t : lambda_ts... {
32 template <
typename... T>
33 composer_t( T&&... t ) : lambda_ts(
std::
forward<T>( t ) )...
37 using lambda_ts::operator()...;
42 template <
typename... lambda_ts>
45 template <
typename lambda_t>
47 composer_t(
const lambda_t& lambda ) : lambda_t{lambda} {}
50 using lambda_t::operator();
53 template <
typename lambda_t,
typename... more_lambda_ts>
56 template <
typename... lambda_ts>
57 composer_t(
const lambda_t& lambda, lambda_ts&&... more_lambdas )
58 : lambda_t{lambda},
super_t{std::forward<lambda_ts>( more_lambdas )...}
61 template <
typename... lambda_ts>
62 composer_t( lambda_t&& lambda, lambda_ts&&... more_lambdas )
63 : lambda_t{
std::move( lambda )},
super_t{std::forward<lambda_ts>( more_lambdas )...}
66 using lambda_t::operator();
67 using super_t::operator();
71 template <
typename... lambda_ts>
74 return {std::forward<lambda_ts>( lambdas )...};
90 namespace GaudiMathImplementation
116 double operator()(
const Argument& x )
const override;
163 typedef double ( *
Function )(
const double,
const double );
174 double operator()(
double x ) const override;
176 double operator()( const Argument& x ) const override;
178 unsigned int dimensionality()
const override {
return 2; }
185 double operator()(
const double x,
const double y )
const;
226 typedef double ( *
Function )(
const double,
const double,
const double );
237 double operator()(
double x ) const override;
239 double operator()( const Argument& x ) const override;
241 unsigned int dimensionality()
const override {
return 3; }
248 double operator()(
const double x,
const double y,
const double z )
const;
271 typedef double ( *Function1 )(
const double );
272 typedef double ( *Function2 )(
const double* );
299 unsigned int dimensionality()
const override 302 [&]( auto ) {
return m_arg.size(); } );
309 double operator()(
const Argument& )
const override;
314 boost::variant<Function1, Function2, Function3>
m_func;
323 #if defined( __clang__ ) || defined( __CLING__ ) 324 #pragma clang diagnostic pop 325 #elif defined( __GNUC__ ) && __GNUC__ >= 5 326 #pragma GCC diagnostic pop 329 #endif // GAUDIMATH_FUNADAPTERS_H composer_t(lambda_t &&lambda, lambda_ts &&...more_lambdas)
composer_t< std::decay_t< lambda_ts >... > compose(lambda_ts &&...lambdas)
composer_t(const lambda_t &lambda)
bool hasAnalyticDerivative() const override
Does this function have an analytic derivative?
mandatory macro from CLHEP/GenericFunctions
Genfun::AbsFunction Function
Genfun::GaudiMathImplementation::NumericalDerivative Derivative
bool hasAnalyticDerivative() const override
Does this function have an analytic derivative?
bool hasAnalyticDerivative() const override
Does this function have an analytic derivative?
PropertyMgr & operator=(const PropertyMgr &)=delete
mandatory macro from CLHEP/GenericFunctions
TupleObj.h GaudiAlg/TupleObj.h namespace with few technical implementations.
std::vector< double > m_arg
boost::variant< Function1, Function2, Function3 > m_func
mandatory macro from CLHEP/GenericFunctions
composer_t(const lambda_t &lambda, lambda_ts &&...more_lambdas)
const AIDA::IFunction * m_fun
virtual Out operator()(const vector_of_const_< In > &inputs) const =0
std::vector< double > m_arg
double fun(const std::vector< double > &x)
composer_t(lambda_t &&lambda)
unsigned int dimensionality() const override
bool hasAnalyticDerivative() const override
Does this function have an analytic derivative?
constructor from the IFunction ( see AIDA/IFunction.h)