QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
abcdvol.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) 2006, 2007 Ferdinando Ametrano
5 Copyright (C) 2006 Mark Joshi
6 Copyright (C) 2005, 2006 Klaus Spanderen
7
8 This file is part of QuantLib, a free-software/open-source library
9 for financial quantitative analysts and developers - http://quantlib.org/
10
11 QuantLib is free software: you can redistribute it and/or modify it
12 under the terms of the QuantLib license. You should have received a
13 copy of the license along with this program; if not, please email
14 <quantlib-dev@lists.sf.net>. The license is also available online at
15 <http://quantlib.org/license.shtml>.
16
17 This program is distributed in the hope that it will be useful, but WITHOUT
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 FOR A PARTICULAR PURPOSE. See the license for more details.
20*/
21
22
23#ifndef quantlib_exp_corr_abcd_vol_hpp
24#define quantlib_exp_corr_abcd_vol_hpp
25
28#include <ql/math/matrix.hpp>
29#include <vector>
30
31namespace QuantLib {
32
33 class PiecewiseConstantCorrelation;
34
35 //! %Abcd-interpolated volatility structure
36 class AbcdVol : public MarketModel {
37 public:
38 AbcdVol(Real a,
39 Real b,
40 Real c,
41 Real d,
42 const std::vector<Real>& ks,
43 const ext::shared_ptr<PiecewiseConstantCorrelation>& corr,
46 const std::vector<Rate>& initialRates,
47 const std::vector<Spread>& displacements);
48 //! \name MarketModel interface
49 //@{
50 const std::vector<Rate>& initialRates() const override;
51 const std::vector<Spread>& displacements() const override;
52 const EvolutionDescription& evolution() const override;
53 Size numberOfRates() const override;
54 Size numberOfFactors() const override;
55 Size numberOfSteps() const override;
56 const Matrix& pseudoRoot(Size i) const override;
57 //@}
58 private:
60 std::vector<Rate> initialRates_;
61 std::vector<Spread> displacements_;
63 std::vector<Matrix> pseudoRoots_;
64 };
65
66 // inline
67
68 inline const std::vector<Rate>& AbcdVol::initialRates() const {
69 return initialRates_;
70 }
71
72 inline const std::vector<Spread>& AbcdVol::displacements() const {
73 return displacements_;
74 }
75
77 return evolution_;
78 }
79
81 return numberOfRates_;
82 }
83
85 return numberOfFactors_;
86 }
87
89 return numberOfSteps_;
90 }
91
92 inline const Matrix& AbcdVol::pseudoRoot(Size i) const {
94 "the index " << i << " is invalid: it must be less than "
95 "number of steps (" << numberOfSteps_ << ")");
96 return pseudoRoots_[i];
97 }
98}
99
100#endif
Abcd-interpolated volatility structure
Definition: abcdvol.hpp:36
const std::vector< Spread > & displacements() const override
Definition: abcdvol.hpp:72
std::vector< Spread > displacements_
Definition: abcdvol.hpp:61
const std::vector< Rate > & initialRates() const override
Definition: abcdvol.hpp:68
std::vector< Matrix > pseudoRoots_
Definition: abcdvol.hpp:63
const Matrix & pseudoRoot(Size i) const override
Definition: abcdvol.hpp:92
std::vector< Rate > initialRates_
Definition: abcdvol.hpp:60
const EvolutionDescription & evolution() const override
Definition: abcdvol.hpp:76
EvolutionDescription evolution_
Definition: abcdvol.hpp:62
Size numberOfFactors_
Definition: abcdvol.hpp:59
Size numberOfFactors() const override
Definition: abcdvol.hpp:84
Size numberOfRates() const override
Definition: abcdvol.hpp:80
Size numberOfSteps() const override
Definition: abcdvol.hpp:88
Market-model evolution description.
base class for market models
Definition: marketmodel.hpp:39
Matrix used in linear algebra.
Definition: matrix.hpp:41
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Definition: errors.hpp:117
Date d
ext::function< Real(Real)> b
QL_REAL Real
real number
Definition: types.hpp:50
std::size_t Size
size of a container
Definition: types.hpp:58
matrix used in linear algebra.
Definition: any.hpp:35