QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
bumpinstrumentjacobian.hpp
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_bump_instrument_jacobian_hpp
23#define quantlib_bump_instrument_jacobian_hpp
24
25
26#include <ql/models/marketmodels/marketmodel.hpp>
27#include <ql/models/marketmodels/pathwisegreeks/vegabumpcluster.hpp>
28#include <valarray>
29
30namespace QuantLib
31{
33 {
34 public:
35
36 struct Swaption
37 {
40 };
41
42 struct Cap
43 {
47
48 };
49
50
52 const std::vector<Swaption>& swaptions,
53 const std::vector<Cap>& caps);
54
55
57 {
58 return bumps_;
59 }
60
61 std::vector<Real> derivativesVolatility(Size j) const;
62
63 std::vector<Real> onePercentBump(
64 Size j) const; // vector of smallest size that changes instrument implied vol by 1
65 // percent i.e. 0.01 v / <v,v> with v result of derivativesVolatility
66
67 const Matrix& getAllOnePercentBumps() const;
68
69 private:
71 std::vector<Swaption> swaptions_;
72 std::vector<Cap> caps_;
73 mutable std::valarray<bool> computed_;
74 mutable bool allComputed_;
75 mutable std::vector<std::vector<Real> > derivatives_;
76
77 mutable std::vector<std::vector<Real> > onePercentBumps_;
79 };
80
91 {
92 public:
94 const std::vector<VolatilityBumpInstrumentJacobian::Swaption>& swaptions,
95 const std::vector<VolatilityBumpInstrumentJacobian::Cap>& caps,
96 Real multiplierCutOff, // if vector length grows by more than this discard
97 Real tolerance); // if vector projection before scaling less than this discard
98
99 void GetVegaBumps(std::vector<std::vector<Matrix> >& theBumps) const; // this is precisely the vector to pass into PathwiseVegasAccountingEngine
100
101
102 private:
103
107
108
109 };
110
111
112
113
114}
115
116#endif
Matrix used in linear algebra.
Definition: matrix.hpp:41
VolatilityBumpInstrumentJacobian derivativesProducer_
void GetVegaBumps(std::vector< std::vector< Matrix > > &theBumps) const
const VegaBumpCollection & getInputBumps() const
std::vector< std::vector< Real > > derivatives_
std::vector< Real > onePercentBump(Size j) const
std::vector< std::vector< Real > > onePercentBumps_
std::vector< Real > derivativesVolatility(Size j) const
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