QuantLib
: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
ql
math
richardsonextrapolation.hpp
Go to the documentation of this file.
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*
4
Copyright (C) 2012 Klaus Spanderen
5
6
This file is part of QuantLib, a free-software/open-source library
7
for financial quantitative analysts and developers - http://quantlib.org/
8
9
QuantLib is free software: you can redistribute it and/or modify it
10
under the terms of the QuantLib license. You should have received a
11
copy of the license along with this program; if not, please email
12
<quantlib-dev@lists.sf.net>. The license is also available online at
13
<http://quantlib.org/license.shtml>.
14
15
This program is distributed in the hope that it will be useful, but WITHOUT
16
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17
FOR A PARTICULAR PURPOSE. See the license for more details.
18
*/
19
20
/*! \file richardsonextrapolation.hpp
21
*/
22
23
#ifndef quantlib_richardson_extrapolation_hpp
24
#define quantlib_richardson_extrapolation_hpp
25
26
#include <
ql/types.hpp
>
27
#include <
ql/utilities/null.hpp
>
28
#include <
ql/functional.hpp
>
29
30
namespace
QuantLib
{
31
32
//! Richardson Extrapolation
33
/*! Richardson Extrapolation is a sequence acceleration technique for
34
\f[
35
f(\Delta h) = f_0 + \alpha\cdot (\Delta h)^n + O((\Delta h)^{n+1})
36
\f]
37
*/
38
39
/*! References:
40
http://en.wikipedia.org/wiki/Richardson_extrapolation
41
*/
42
43
class
RichardsonExtrapolation
{
44
public
:
45
/*! Richardon Extrapolation
46
\param f function to be extrapolated to delta_h -> 0
47
\param delta_h step size
48
\param n if known, n is the order of convergence
49
*/
50
RichardsonExtrapolation
(
const
ext::function<
Real
(
Real
)>&
f
,
51
Real
delta_h,
Real
n
=
Null<Real>
());
52
53
54
/*! Extrapolation for known order of convergence
55
\param t scaling factor for the step size
56
*/
57
Real
operator()
(
Real
t
=2.0)
const
;
58
59
/*! Extrapolation for unknown order of convergence
60
\param t first scaling factor for the step size
61
\param s second scaling factor for the step size
62
*/
63
Real
operator()
(
Real
t
,
Real
s
)
const
;
64
65
private
:
66
const
Real
delta_h_
;
67
const
Real
fdelta_h_
;
68
const
Real
n_
;
69
const
ext::function<
Real
(
Real
)>
f_
;
70
};
71
}
72
73
#endif
n
Size n
Definition:
andreasenhugevolatilityinterpl.cpp:47
QuantLib::Null
template class providing a null value for a given type.
Definition:
null.hpp:76
QuantLib::RichardsonExtrapolation
Richardson Extrapolation.
Definition:
richardsonextrapolation.hpp:43
QuantLib::RichardsonExtrapolation::delta_h_
const Real delta_h_
Definition:
richardsonextrapolation.hpp:66
QuantLib::RichardsonExtrapolation::operator()
Real operator()(Real t=2.0) const
Definition:
richardsonextrapolation.cpp:55
QuantLib::RichardsonExtrapolation::n_
const Real n_
Definition:
richardsonextrapolation.hpp:68
QuantLib::RichardsonExtrapolation::f_
const ext::function< Real(Real)> f_
Definition:
richardsonextrapolation.hpp:69
QuantLib::RichardsonExtrapolation::fdelta_h_
const Real fdelta_h_
Definition:
richardsonextrapolation.hpp:67
f
F f
Definition:
defaultdensitystructure.cpp:32
t
const DefaultType & t
Definition:
defaultprobabilitykey.cpp:39
functional.hpp
Maps function, bind and cref to either the boost or std implementation.
QuantLib::Real
QL_REAL Real
real number
Definition:
types.hpp:50
QuantLib
Definition:
any.hpp:35
null.hpp
null values
s
Real s
Definition:
perturbativebarrieroptionengine.cpp:1488
types.hpp
Custom types.
Generated by
Doxygen
1.9.5