QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
fwdtocotswapadapter.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2006 Ferdinando Ametrano
5 Copyright (C) 2006 Mark Joshi
6 Copyright (C) 2007 StatPro Italia srl
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#ifndef quantlib_forward_to_coterminal_adapter_hpp
23#define quantlib_forward_to_coterminal_adapter_hpp
24
25#include <ql/models/marketmodels/marketmodel.hpp>
26
27namespace QuantLib {
28
29 class EvolutionDescription;
30
32 public:
34 const ext::shared_ptr<MarketModel>& forwardModel);
36
37 const std::vector<Rate>& initialRates() const override;
38 const std::vector<Spread>& displacements() const override;
39 const EvolutionDescription& evolution() const override;
40 Size numberOfRates() const override;
41 Size numberOfFactors() const override;
42 Size numberOfSteps() const override;
43 const Matrix& pseudoRoot(Size i) const override;
45 private:
46 ext::shared_ptr<MarketModel> fwdModel_;
48 std::vector<Rate> initialRates_;
49 std::vector<Matrix> pseudoRoots_;
50 };
51
52
54 public Observer {
55 public:
57 const ext::shared_ptr<MarketModelFactory>& forwardFactory);
58 ext::shared_ptr<MarketModel> create(const EvolutionDescription&,
59 Size numberOfFactors) const override;
60 void update() override;
61
62 private:
63 ext::shared_ptr<MarketModelFactory> forwardFactory_;
64 };
65
66
67 // inline definitions
68
69 inline const std::vector<Rate>&
71 return initialRates_;
72 }
73
74 inline const std::vector<Spread>&
76 return fwdModel_->displacements();
77 }
78
79 inline const EvolutionDescription&
81 return fwdModel_->evolution();
82 }
83
85 return fwdModel_->numberOfRates();
86 }
87
89 return fwdModel_->numberOfFactors();
90 }
91
93 return fwdModel_->numberOfSteps();
94 }
95
97 return pseudoRoots_[i];
98 }
99
100}
101
102#endif
Market-model evolution description.
ext::shared_ptr< MarketModelFactory > forwardFactory_
ext::shared_ptr< MarketModel > create(const EvolutionDescription &, Size numberOfFactors) const override
const std::vector< Spread > & displacements() const override
const std::vector< Rate > & initialRates() const override
std::vector< Matrix > pseudoRoots_
const Matrix & pseudoRoot(Size i) const override
const EvolutionDescription & evolution() const override
Size numberOfFactors() const override
Size numberOfRates() const override
Size numberOfSteps() const override
ext::shared_ptr< MarketModel > fwdModel_
base class for market-model factories
Definition: marketmodel.hpp:57
base class for market models
Definition: marketmodel.hpp:39
Matrix used in linear algebra.
Definition: matrix.hpp:41
Object that gets notified when a given observable changes.
Definition: observable.hpp:116
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35