QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
NumericalDifferentiation Class Reference

Numerical Differentiation on arbitrarily spaced grids. More...

#include <numericaldifferentiation.hpp>

+ Collaboration diagram for NumericalDifferentiation:

Public Types

enum  Scheme { Central , Backward , Forward }
 

Public Member Functions

 NumericalDifferentiation (ext::function< Real(Real)> f, Size orderOfDerivative, Array x_offsets)
 
 NumericalDifferentiation (ext::function< Real(Real)> f, Size orderOfDerivative, Real stepSize, Size steps, Scheme scheme)
 
Real operator() (Real x) const
 
const Arrayoffsets () const
 
const Arrayweights () const
 

Private Attributes

const Array offsets_
 
const Array w_
 
const ext::function< Real(Real)> f_
 

Detailed Description

Numerical Differentiation on arbitrarily spaced grids.

References:

B. Fornberg, 1988. Generation of Finite Difference Formulas on Arbitrarily Spaced Grids, http://amath.colorado.edu/faculty/fornberg/Docs/MathComp_88_FD_formulas.pdf

Definition at line 41 of file numericaldifferentiation.hpp.

Member Enumeration Documentation

◆ Scheme

enum Scheme
Enumerator
Central 
Backward 
Forward 

Definition at line 43 of file numericaldifferentiation.hpp.

Constructor & Destructor Documentation

◆ NumericalDifferentiation() [1/2]

NumericalDifferentiation ( ext::function< Real(Real)>  f,
Size  orderOfDerivative,
Array  x_offsets 
)

Definition at line 104 of file numericaldifferentiation.cpp.

◆ NumericalDifferentiation() [2/2]

NumericalDifferentiation ( ext::function< Real(Real)>  f,
Size  orderOfDerivative,
Real  stepSize,
Size  steps,
Scheme  scheme 
)

Definition at line 111 of file numericaldifferentiation.cpp.

Member Function Documentation

◆ operator()()

Real operator() ( Real  x) const

Definition at line 65 of file numericaldifferentiation.hpp.

+ Here is the call graph for this function:

◆ offsets()

const Array & offsets ( ) const

Definition at line 79 of file numericaldifferentiation.hpp.

◆ weights()

const Array & weights ( ) const

Definition at line 75 of file numericaldifferentiation.hpp.

+ Here is the caller graph for this function:

Member Data Documentation

◆ offsets_

const Array offsets_
private

Definition at line 60 of file numericaldifferentiation.hpp.

◆ w_

const Array w_
private

Definition at line 60 of file numericaldifferentiation.hpp.

◆ f_

const ext::function<Real(Real)> f_
private

Definition at line 61 of file numericaldifferentiation.hpp.