QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
pseudorootfacade.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2007 Ferdinando Ametrano
5 Copyright (C) 2007 Mark Joshi
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
22#ifndef quantlib_pseudoroot_facade_hpp
23#define quantlib_pseudoroot_facade_hpp
24
25#include <ql/models/marketmodels/models/ctsmmcapletcalibration.hpp>
26#include <ql/models/marketmodels/marketmodel.hpp>
27#include <ql/models/marketmodels/evolutiondescription.hpp>
28#include <ql/math/matrix.hpp>
29#include <vector>
30
31namespace QuantLib
32{
34 public:
35 PseudoRootFacade(const ext::shared_ptr<CTSMMCapletCalibration>& calibrator);
36 PseudoRootFacade(const std::vector<Matrix>& covariancePseudoRoots,
37 const std::vector<Rate>& rateTimes,
38 std::vector<Rate> initialRates,
39 const std::vector<Spread>& displacements);
41
42 const std::vector<Rate>& initialRates() const override;
43 const std::vector<Spread>& displacements() const override;
44 const EvolutionDescription& evolution() const override;
45 Size numberOfRates() const override;
46 Size numberOfFactors() const override;
47 Size numberOfSteps() const override;
48 const Matrix& pseudoRoot(Size i) const override;
50 private:
52 std::vector<Rate> initialRates_;
53 std::vector<Spread> displacements_;
55 std::vector<Matrix> covariancePseudoRoots_;
56 };
57
58 // inline
59
60 inline const std::vector<Rate>& PseudoRootFacade::initialRates() const {
61 return initialRates_;
62 }
63
64 inline const std::vector<Spread>& PseudoRootFacade::displacements() const {
65 return displacements_;
66 }
67
69 return evolution_;
70 }
71
73 return numberOfRates_;
74 }
75
77 return numberOfFactors_;
78 }
79
81 return numberOfSteps_;
82 }
83
84 inline const Matrix& PseudoRootFacade::pseudoRoot(Size i) const {
85 QL_REQUIRE(i<numberOfSteps_,
86 "the index " << i << " is invalid: it must be less than "
87 "number of steps (" << numberOfSteps_ << ")");
88 return covariancePseudoRoots_[i];
89 }
90}
91
92#endif
Market-model evolution description.
base class for market models
Definition: marketmodel.hpp:39
Matrix used in linear algebra.
Definition: matrix.hpp:41
const std::vector< Spread > & displacements() const override
std::vector< Spread > displacements_
const std::vector< Rate > & initialRates() const override
const Matrix & pseudoRoot(Size i) const override
std::vector< Rate > initialRates_
const EvolutionDescription & evolution() const override
EvolutionDescription evolution_
Size numberOfFactors() const override
Size numberOfRates() const override
Size numberOfSteps() const override
std::vector< Matrix > covariancePseudoRoots_
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35