QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
polynomialmathfunction.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2015 Ferdinando Ametrano
5 Copyright (C) 2015 Paolo Mazzocchi
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
21#ifndef quantlib_polynomial_math_function_hpp
22#define quantlib_polynomial_math_function_hpp
23
24#include <ql/math/matrix.hpp>
25
26#include <vector>
27
28namespace QuantLib {
29
31
33
34 public:
38 QL_DEPRECATED
40
44 QL_DEPRECATED
46
47 PolynomialFunction(const std::vector<Real>& coeff);
48
50 Real operator()(Time t) const;
51
54 Real derivative(Time t) const;
55
58 Real primitive(Time t) const;
59
63 Time t2) const;
64
66 Size order() const { return order_; }
67 const std::vector<Real>& coefficients() { return c_; }
68 const std::vector<Real>& derivativeCoefficients() { return derC_; }
69 const std::vector<Real>& primitiveCoefficients() { return prC_; }
70
73 std::vector<Real> definiteIntegralCoefficients(Time t,
74 Time t2) const;
75
78 std::vector<Real> definiteDerivativeCoefficients(Time t,
79 Time t2) const;
80
81 private:
83 std::vector<Real> c_, derC_, prC_;
85 mutable Matrix eqs_;
86 void initializeEqs_(Time t,
87 Time t2) const;
88 };
89
90}
91
92#endif
Matrix used in linear algebra.
Definition: matrix.hpp:41
Real definiteIntegral(Time t1, Time t2) const
const std::vector< Real > & primitiveCoefficients()
void initializeEqs_(Time t, Time t2) const
const std::vector< Real > & derivativeCoefficients()
std::vector< Real > definiteIntegralCoefficients(Time t, Time t2) const
const std::vector< Real > & coefficients()
QL_DEPRECATED typedef Time argument_type
QL_DEPRECATED typedef Real result_type
Real operator()(Time t) const
function value at time t:
std::vector< Real > definiteDerivativeCoefficients(Time t, Time t2) const
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
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