QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
integral.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2007 François du Vignaud
3
4 This file is part of QuantLib, a free-software/open-source library
5 for financial quantitative analysts and developers - http://quantlib.org/
6
7 QuantLib is free software: you can redistribute it and/or modify it
8 under the terms of the QuantLib license. You should have received a
9 copy of the license along with this program; if not, please email
10 <quantlib-dev@lists.sf.net>. The license is also available online at
11 <http://quantlib.org/license.shtml>.
12
13 This program is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the license for more details.
16*/
17
18/*! \file integral.hpp
19\brief Integrators base class definition
20*/
21
22#ifndef quantlib_math_integrator_hpp
23#define quantlib_math_integrator_hpp
24
25#include <ql/types.hpp>
26#include <ql/functional.hpp>
27
28namespace QuantLib {
29
31 public:
34 virtual ~Integrator() = default;
35
36 Real operator()(const ext::function<Real (Real)>& f,
37 Real a,
38 Real b) const;
39
40 //! \name Modifiers
41 //@{
44 //@}
45
46 //! \name Inspectors
47 //@{
48 Real absoluteAccuracy() const;
49 Size maxEvaluations() const;
50 //@}
51
52 Real absoluteError() const ;
53
55
56 virtual bool integrationSuccess() const;
57
58 protected:
59 virtual Real integrate(const ext::function<Real (Real)>& f,
60 Real a,
61 Real b) const = 0;
62 void setAbsoluteError(Real error) const;
63 void setNumberOfEvaluations(Size evaluations) const;
64 void increaseNumberOfEvaluations(Size increase) const;
65 private:
70 };
71
72}
73
74
75#endif
Real absoluteAccuracy() const
Definition: integral.cpp:43
Size numberOfEvaluations() const
Definition: integral.cpp:59
Size maxEvaluations() const
Definition: integral.cpp:47
virtual ~Integrator()=default
void setMaxEvaluations(Size)
Definition: integral.cpp:39
Real operator()(const ext::function< Real(Real)> &f, Real a, Real b) const
Definition: integral.cpp:76
void increaseNumberOfEvaluations(Size increase) const
Definition: integral.cpp:67
void setAbsoluteError(Real error) const
Definition: integral.cpp:55
Real absoluteError() const
Definition: integral.cpp:51
void setNumberOfEvaluations(Size evaluations) const
Definition: integral.cpp:63
void setAbsoluteAccuracy(Real)
Definition: integral.cpp:35
virtual Real integrate(const ext::function< Real(Real)> &f, Real a, Real b) const =0
virtual bool integrationSuccess() const
Definition: integral.cpp:71
ext::function< Real(Real)> b
Maps function, bind and cref to either the boost or std implementation.
QL_REAL Real
real number
Definition: types.hpp:50
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35
Custom types.