mpqc::math::FiniteDifferenceDerivative< Order, Value, Parameters > Class Template Reference
Collaboration diagram for mpqc::math::FiniteDifferenceDerivative< Order, Value, Parameters >:

Documentation

template<size_t Order, typename Value, typename Parameters>
class mpqc::math::FiniteDifferenceDerivative< Order, Value, Parameters >

Computes finite-difference approximation to function derivatives.

Public Member Functions

 FiniteDifferenceDerivative (const KeyVal &kv)
 
- Public Member Functions inherited from mpqc::math::TaylorExpansionFunction< Value, Parameters >
size_t order () const
 
double target_precision (size_t ord) const
 
- Public Member Functions inherited from mpqc::math::Function< TaylorExpansionCoefficients< Value >, Parameters >
 Function ()=default
 
 Function (std::shared_ptr< Parameters > params)
 
virtual ~Function ()
 
std::shared_ptr< const TaylorExpansionCoefficients< Value > > value ()
 
bool must_compute () const
 
std::shared_ptr< const Parameters > params () const
 
virtual void set_params (std::shared_ptr< Parameters > params)
 
- Public Member Functions inherited from mpqc::DescribedClass
 DescribedClass ()=default
 
virtual ~DescribedClass ()
 
std::string class_key () const
 
- Public Member Functions inherited from mpqc::enable_shared_from_this< DescribedClass >
virtual ~enable_shared_from_this ()=default
 
std::shared_ptr< DescribedClassshared_from_this ()
 returns the pointer to this object More...
 
std::shared_ptr< std::add_const_t< DescribedClass > > shared_from_this () const
 returns the pointer to this object More...
 
- Public Member Functions inherited from mpqc::detail::virt_base_of_enable_shared_from_this
virtual ~virt_base_of_enable_shared_from_this ()=default
 
bool shared_from_this_possible () const
 
template<typename Target , typename = std::enable_if_t<!std::is_const_v<Target>>>
std::shared_ptr< Target > cast_shared_from_this_to ()
 returns the pointer to this cast to a particular type More...
 
template<typename Target >
std::shared_ptr< std::add_const_t< Target > > cast_shared_from_this_to () const
 returns the pointer to this cast to a particular type More...
 

Protected Types

using DerivIdx = std::array< size_t, Order >
 
using Displacement = std::array< double, Order >
 
using LinearCombinationOfDisplacements = std::vector< std::pair< Displacement, double > >
 
using function_type = TaylorExpansionFunction< Value, Parameters >
 the function to differentiate More...
 

Protected Member Functions

 FiniteDifferenceDerivative (const KeyVal &kv, std::shared_ptr< Parameters > params, double default_target_precision)
 The KeyVal constructor. More...
 
virtual LinearCombinationOfDisplacements generate_displacements (DerivIdx idx) const
 
std::shared_ptr< const function_typefunction () const
 
double delta () const
 
size_t error_order () const
 
- Protected Member Functions inherited from mpqc::math::TaylorExpansionFunction< Value, Parameters >
 TaylorExpansionFunction (const KeyVal &kv, std::shared_ptr< Parameters > params, double default_precision=default_precision_)
 auxiliary KeyVal constructor More...
 
- Protected Member Functions inherited from mpqc::math::Function< TaylorExpansionCoefficients< Value >, Parameters >
const Timestampable< TaylorExpansionCoefficients< Value > > & get_value () const
 
void set_value (TaylorExpansionCoefficients< Value > v)
 

Additional Inherited Members

- Public Types inherited from mpqc::math::TaylorExpansionFunction< Value, Parameters >
typedef Function< TaylorExpansionCoefficients< Value >, Parameters > function_base_type
 
- Public Types inherited from mpqc::math::Function< TaylorExpansionCoefficients< Value >, Parameters >
typedef TaylorExpansionCoefficients< Value > value_type
 
typedef Parameters parameters_type
 
using Timestampable = ::mpqc::utility::Timestampable< X >
 
- Public Types inherited from mpqc::DescribedClass
typedef std::shared_ptr< DescribedClass >(* keyval_ctor_wrapper_type) (const KeyVal &)
 
- Static Public Member Functions inherited from mpqc::DescribedClass
static keyval_ctor_wrapper_type type_to_keyval_ctor (const std::string &type_name)
 
template<typename T >
static void register_keyval_ctor ()
 
template<typename T >
static bool is_registered ()
 
template<typename T >
static std::string class_key ()
 
static const keyval_ctor_registry_type & keyval_ctor_registry ()
 returns const ref to the keyval ctor registry More...
 
- Static Protected Attributes inherited from mpqc::math::TaylorExpansionFunction< Value, Parameters >
static constexpr double default_precision_ = 1e-8
 the default target precision to use if not provided to the constructor More...
 

Member Typedef Documentation

◆ DerivIdx

template<size_t Order, typename Value , typename Parameters >
using mpqc::math::FiniteDifferenceDerivative< Order, Value, Parameters >::DerivIdx = std::array<size_t, Order>
protected

◆ Displacement

template<size_t Order, typename Value , typename Parameters >
using mpqc::math::FiniteDifferenceDerivative< Order, Value, Parameters >::Displacement = std::array<double, Order>
protected

◆ function_type

template<size_t Order, typename Value , typename Parameters >
using mpqc::math::FiniteDifferenceDerivative< Order, Value, Parameters >::function_type = TaylorExpansionFunction<Value, Parameters>
protected

the function to differentiate

◆ LinearCombinationOfDisplacements

template<size_t Order, typename Value , typename Parameters >
using mpqc::math::FiniteDifferenceDerivative< Order, Value, Parameters >::LinearCombinationOfDisplacements = std::vector<std::pair<Displacement, double> >
protected

Constructor & Destructor Documentation

◆ FiniteDifferenceDerivative() [1/2]

template<size_t Order, typename Value , typename Parameters >
mpqc::math::FiniteDifferenceDerivative< Order, Value, Parameters >::FiniteDifferenceDerivative ( const KeyVal kv)
inline

◆ FiniteDifferenceDerivative() [2/2]

template<size_t Order, typename Value , typename Parameters >
mpqc::math::FiniteDifferenceDerivative< Order, Value, Parameters >::FiniteDifferenceDerivative ( const KeyVal kv,
std::shared_ptr< Parameters >  params,
double  default_target_precision 
)
inlineprotected

The KeyVal constructor.

Parameters
kvthe KeyVal object to be queried

The KeyVal object will be queried for all keywords of the protected KeyVal ctor of the TaylorExpansionFunction class, as well as the following keywords:

Keyword Type Default Description
delta real 0.01 the displacement size, in the internal units of Parameters
error_order int accuracy of the finite difference stencil controls the stencil order to use: 0 = use the lowest order stensil (accurate to $ \mathcal{O}(\delta^2) $ ), 1 = next lowest order (accurate to $ \mathcal{O}(\delta^24) $ ), etc.

Member Function Documentation

◆ delta()

template<size_t Order, typename Value , typename Parameters >
double mpqc::math::FiniteDifferenceDerivative< Order, Value, Parameters >::delta ( ) const
inlineprotected

◆ error_order()

template<size_t Order, typename Value , typename Parameters >
size_t mpqc::math::FiniteDifferenceDerivative< Order, Value, Parameters >::error_order ( ) const
inlineprotected

◆ function()

template<size_t Order, typename Value , typename Parameters >
std::shared_ptr<const function_type> mpqc::math::FiniteDifferenceDerivative< Order, Value, Parameters >::function ( ) const
inlineprotected

◆ generate_displacements()

template<size_t Order, typename Value , typename Parameters >
virtual LinearCombinationOfDisplacements mpqc::math::FiniteDifferenceDerivative< Order, Value, Parameters >::generate_displacements ( DerivIdx  idx) const
inlineprotectedvirtual

derived classes may need to customize how displacements are computed

Parameters
idxthe index of the derivative
Returns
the stensil formula as a LinearCombinationOfDisplacements

manual implementations of FiniteDifferenceDerivative::generate_displacements for different orders


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