QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
cmsmarketcalibration.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) 2007 Marco Bianchetti
5 Copyright (C) 2006, 2007 Giorgio Facchinetti
6 Copyright (C) 2014 Peter Caspers
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/*! \file cmsmarketcalibration.hpp
23*/
24
25#ifndef quantlib_cms_market_calibration_h
26#define quantlib_cms_market_calibration_h
27
29#include <ql/math/matrix.hpp>
30#include <ql/math/array.hpp>
31#include <ql/handle.hpp>
32
33namespace QuantLib {
34
35 class SwaptionVolatilityStructure;
36 class CmsMarket;
37 class OptimizationMethod;
38
40 public:
42
45 ext::shared_ptr<CmsMarket>& cmsMarket,
46 const Matrix& weights,
47 CalibrationType calibrationType);
48
50 ext::shared_ptr<CmsMarket> cmsMarket_;
54
55 Array compute(const ext::shared_ptr<EndCriteria>& endCriteria,
56 const ext::shared_ptr<OptimizationMethod>& method,
57 const Array& guess,
58 bool isMeanReversionFixed);
59
60 Matrix compute(const ext::shared_ptr<EndCriteria>& endCriteria,
61 const ext::shared_ptr<OptimizationMethod>& method,
62 const Matrix& guess,
63 bool isMeanReversionFixed,
64 Real meanReversionGuess = Null<Real>());
65
66 Matrix computeParametric(const ext::shared_ptr<EndCriteria>& endCriteria,
67 const ext::shared_ptr<OptimizationMethod>& method,
68 const Matrix& guess,
69 bool isMeanReversionFixed,
70 Real meanReversionGuess = Null<Real>());
71
72 Real error() const { return error_; }
74
76 return std::sqrt(-std::log(beta));
77 }
79 return std::max(
80 std::min(std::fabs(y) < 10.0 ? Real(std::exp(-(y * y))) : 0.0,
81 0.999999),
82 0.000001);
83 }
85 return reversion * reversion;
86 }
88 return std::sqrt(y);
89 }
90
91 private:
94 };
95
96}
97
98#endif
1-D array used in linear algebra.
1-D array used in linear algebra.
Definition: array.hpp:52
static Real reversionTransformDirect(Real y)
static Real betaTransformInverse(Real beta)
Matrix computeParametric(const ext::shared_ptr< EndCriteria > &endCriteria, const ext::shared_ptr< OptimizationMethod > &method, const Matrix &guess, bool isMeanReversionFixed, Real meanReversionGuess=Null< Real >())
Array compute(const ext::shared_ptr< EndCriteria > &endCriteria, const ext::shared_ptr< OptimizationMethod > &method, const Array &guess, bool isMeanReversionFixed)
static Real reversionTransformInverse(Real reversion)
ext::shared_ptr< CmsMarket > cmsMarket_
Handle< SwaptionVolatilityStructure > volCube_
Shared handle to an observable.
Definition: handle.hpp:41
Matrix used in linear algebra.
Definition: matrix.hpp:41
template class providing a null value for a given type.
Definition: null.hpp:76
Optimization criteria class.
QL_REAL Real
real number
Definition: types.hpp:50
Globally accessible relinkable pointer.
matrix used in linear algebra.
Definition: any.hpp:35
Real beta
Definition: sabr.cpp:200