QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
vegabumpcluster.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
5 Copyright (C) 2008 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_vega_bump_cluster_hpp
23#define quantlib_vega_bump_cluster_hpp
24
25#include <ql/types.hpp>
27
28/*! When bumping vols, bumping every pseudo-root element individually seems
29excessive so we need to couple some together.
30
31*/
32
33namespace QuantLib
34{
36 {
37 public:
38
45
46 bool doesIntersect(const VegaBumpCluster& comparee) const;
47
48 bool isCompatible(const ext::shared_ptr<MarketModel>& volStructure) const;
50 {
51 return factorBegin_;
52 }
53
55 {
56 return factorEnd_;
57 }
58
59
61 {
62 return rateBegin_;
63 }
64 Size rateEnd() const
65 {
66 return rateEnd_;
67 }
68
70 {
71 return stepBegin_;
72 }
73
74 Size stepEnd() const
75 {
76 return stepEnd_;
77 }
78
79
80 private:
81
88
89 };
90
91 /*!
92 There are too many pseudo-root elements to allow bumping them all independently so we cluster them together and
93 then divide all elements into a collection of such clusters.
94
95
96
97 */
98
100 {
101 public:
102
103 VegaBumpCollection(const ext::shared_ptr<MarketModel>& volStructure,
104 bool allowFactorwiseBumping = true);
105
106 VegaBumpCollection(std::vector<VegaBumpCluster> allBumps,
107 ext::shared_ptr<MarketModel> volStructure);
108
109 Size numberBumps() const;
110
111 const ext::shared_ptr<MarketModel>& associatedModel() const
112 {
114 }
115
116
117 const std::vector<VegaBumpCluster>& allBumps() const;
118
119 bool isFull() const; // i.e. is every alive pseudo-root element bumped at least once
120 bool isNonOverlapping() const; // i.e. is every alive pseudo-root element bumped at most once
121 bool isSensible() const; // i.e. is every alive pseudo-root element bumped precisely once
122
123
124 private:
125
126 std::vector<VegaBumpCluster> allBumps_;
127 ext::shared_ptr<MarketModel> associatedVolStructure_;
128 mutable bool checked_;
129 mutable bool nonOverlapped_;
130 mutable bool full_;
131
132
133 };
134
135}
136
137#endif
bool doesIntersect(const VegaBumpCluster &comparee) const
bool isCompatible(const ext::shared_ptr< MarketModel > &volStructure) const
const ext::shared_ptr< MarketModel > & associatedModel() const
ext::shared_ptr< MarketModel > associatedVolStructure_
const std::vector< VegaBumpCluster > & allBumps() const
std::vector< VegaBumpCluster > allBumps_
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35
Custom types.