QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
capletcoterminalalphacalibration.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 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#ifndef quantlib_ctsmm_caplet_calibration_alfa_form_hpp
22#define quantlib_ctsmm_caplet_calibration_alfa_form_hpp
23
25
26namespace QuantLib {
27
28 class AlphaForm;
29
31 public:
33 const EvolutionDescription& evolution,
34 const ext::shared_ptr<PiecewiseConstantCorrelation>& corr,
35 const std::vector<ext::shared_ptr<PiecewiseConstantVariance> >& displacedSwapVariances,
36 const std::vector<Volatility>& capletVols,
37 const ext::shared_ptr<CurveState>& cs,
38 Spread displacement,
39 const std::vector<Real>& alphaInitial,
40 const std::vector<Real>& alphaMax,
41 const std::vector<Real>& alphaMin,
42 bool maximizeHomogeneity,
43 ext::shared_ptr<AlphaForm> parametricForm = ext::shared_ptr<AlphaForm>());
44 // inspector
45 const std::vector<Real>& alpha() const;
46 // actual calibration function
48 const EvolutionDescription& evolution,
50 const std::vector<ext::shared_ptr<PiecewiseConstantVariance> >& displacedSwapVariances,
51 const std::vector<Volatility>& capletVols,
52 const CurveState& cs,
53 Spread displacement,
54
55 const std::vector<Real>& alphaInitial,
56 const std::vector<Real>& alphaMax,
57 const std::vector<Real>& alphaMin,
58 bool maximizeHomogeneity,
59 const ext::shared_ptr<AlphaForm>& parametricForm,
60
61 Size numberOfFactors,
62 Integer steps,
63 Real toleranceForAlphaSolving,
64
65 std::vector<Real>& alpha,
66 std::vector<Real>& a,
67 std::vector<Real>& b,
68
69 std::vector<Matrix>& swapCovariancePseudoRoots);
70
71 private:
73 calibrationImpl_(Natural numberOfFactors, Natural maxIterations, Real tolerance) override;
74 // input
75 std::vector<Real> alphaInitial_, alphaMax_, alphaMin_;
77 ext::shared_ptr<AlphaForm> parametricForm_;
78 // results
79 std::vector<Real> alpha_, a_, b_;
80 };
81
82 inline const std::vector<Real>&
84 QL_REQUIRE(calibrated_, "not successfully calibrated yet");
85 return alpha_;
86 }
87
88}
89
90#endif
static Natural capletAlphaFormCalibration(const EvolutionDescription &evolution, const PiecewiseConstantCorrelation &corr, const std::vector< ext::shared_ptr< PiecewiseConstantVariance > > &displacedSwapVariances, const std::vector< Volatility > &capletVols, const CurveState &cs, Spread displacement, const std::vector< Real > &alphaInitial, const std::vector< Real > &alphaMax, const std::vector< Real > &alphaMin, bool maximizeHomogeneity, const ext::shared_ptr< AlphaForm > &parametricForm, Size numberOfFactors, Integer steps, Real toleranceForAlphaSolving, std::vector< Real > &alpha, std::vector< Real > &a, std::vector< Real > &b, std::vector< Matrix > &swapCovariancePseudoRoots)
Natural calibrationImpl_(Natural numberOfFactors, Natural maxIterations, Real tolerance) override
Curve state for market-model simulations
Definition: curvestate.hpp:41
Market-model evolution description.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Definition: errors.hpp:117
ext::function< Real(Real)> b
QL_REAL Real
real number
Definition: types.hpp:50
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
QL_INTEGER Integer
integer number
Definition: types.hpp:35
Real Spread
spreads on interest rates
Definition: types.hpp:74
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35