OGS
NumLib::detail::ComputeDerivativeWrtOneScalar_FD< Value > Struct Template Reference

Detailed Description

template<typename Value>
struct NumLib::detail::ComputeDerivativeWrtOneScalar_FD< Value >

Forward differences derivative of a function with respect to a single scalar variable.

See also NumLib::ForwardDifferencesStrategy.

Definition at line 92 of file NumericalDifferentiation.h.

#include <NumericalDifferentiation.h>

Public Member Functions

 ComputeDerivativeWrtOneScalar_FD (Value &&unperturbed_value)
 
template<typename Function , typename TupleOfArgs , typename PerturbationStrategy , std::size_t PerturbedArgIdx, std::size_t... AllArgIdcs>
Value operator() (Function const &f, TupleOfArgs const &args, PerturbationStrategy const &pert_strat, std::integral_constant< std::size_t, PerturbedArgIdx >, Eigen::Index const perturbed_arg_component, std::index_sequence< AllArgIdcs... >) const
 

Private Attributes

Value unperturbed_value_
 

Constructor & Destructor Documentation

◆ ComputeDerivativeWrtOneScalar_FD()

template<typename Value >
NumLib::detail::ComputeDerivativeWrtOneScalar_FD< Value >::ComputeDerivativeWrtOneScalar_FD ( Value && unperturbed_value)
inlineexplicit

Definition at line 94 of file NumericalDifferentiation.h.

95 : unperturbed_value_{std::move(unperturbed_value)}
96 {
97 }

Member Function Documentation

◆ operator()()

template<typename Value >
template<typename Function , typename TupleOfArgs , typename PerturbationStrategy , std::size_t PerturbedArgIdx, std::size_t... AllArgIdcs>
Value NumLib::detail::ComputeDerivativeWrtOneScalar_FD< Value >::operator() ( Function const & f,
TupleOfArgs const & args,
PerturbationStrategy const & pert_strat,
std::integral_constant< std::size_t, PerturbedArgIdx > ,
Eigen::Index const perturbed_arg_component,
std::index_sequence< AllArgIdcs... >  ) const
inline

Definition at line 102 of file NumericalDifferentiation.h.

107 {
108 auto const value_plus = f(pert_strat.perturbIf(
109 std::bool_constant<PerturbedArgIdx == AllArgIdcs>{},
110 std::get<AllArgIdcs>(args), 1.0, perturbed_arg_component)...);
111
112 auto const pert = pert_strat.getPerturbation(
114 args, perturbed_arg_component));
115
116 return (value_plus - unperturbed_value_) / pert;
117 }
double getScalarOrVectorComponent(Tuple const &tuple, Eigen::Index component)

References NumLib::detail::getScalarOrVectorComponent(), and NumLib::detail::ComputeDerivativeWrtOneScalar_FD< Value >::unperturbed_value_.

Member Data Documentation

◆ unperturbed_value_

template<typename Value >
Value NumLib::detail::ComputeDerivativeWrtOneScalar_FD< Value >::unperturbed_value_
private

The documentation for this struct was generated from the following file: