QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
alphafinder.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2007 Mark Joshi
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20#ifndef quantlib_alpha_finder_hpp
21#define quantlib_alpha_finder_hpp
22
23#include <ql/models/marketmodels/models/alphaform.hpp>
24#include <ql/shared_ptr.hpp>
25#include <vector>
26
27namespace QuantLib {
28
30 public:
31 AlphaFinder(ext::shared_ptr<AlphaForm> parametricform);
32
33 bool solve(Real alpha0,
34 Integer stepindex,
35 const std::vector<Volatility>& rateonevols,
36 const std::vector<Volatility>& ratetwohomogeneousvols,
37 const std::vector<Real>& correlations,
38 Real w0,
39 Real w1,
40 Real targetVariance,
41 Real tolerance,
42 Real alphaMax,
43 Real alphaMin,
44 Integer steps,
45 Real& alpha,
46 Real& a,
47 Real& b,
48 std::vector<Volatility>& ratetwovols);
49
51 Real alpha0,
52 Integer stepindex,
53 const std::vector<Volatility>& rateonevols,
54 const std::vector<Volatility>& ratetwohomogeneousvols,
55 const std::vector<Real>& correlations,
56 Real w0,
57 Real w1,
58 Real targetVariance,
59 Real tolerance,
60 Real alphaMax,
61 Real alphaMin,
62 Integer steps,
63 Real& alpha,
64 Real& a,
65 Real& b,
66 std::vector<Volatility>& ratetwovols);
67 private:
72 bool testIfSolutionExists(Real alpha);
73 bool finalPart(Real alphaFound,
74 Integer stepindex,
75 const std::vector<Volatility>& ratetwohomogeneousvols,
76 Real quadraticPart,
77 Real linearPart,
78 Real constantPart,
79 Real& alpha,
80 Real& a,
81 Real& b,
82 std::vector<Volatility>& ratetwovols);
84 ext::shared_ptr<AlphaForm> parametricform_;
86 std::vector<Volatility> rateonevols_, ratetwohomogeneousvols_;
87 std::vector<Volatility> putativevols_;
88 std::vector<Real> correlations_;
92 };
93
94}
95
96#endif
Real minusValueAtTurningPoint(Real alpha)
Real homogeneityfailure(Real alpha)
std::vector< Volatility > ratetwohomogeneousvols_
Definition: alphafinder.hpp:86
bool testIfSolutionExists(Real alpha)
Real valueAtTurningPoint(Real alpha)
bool solveWithMaxHomogeneity(Real alpha0, Integer stepindex, const std::vector< Volatility > &rateonevols, const std::vector< Volatility > &ratetwohomogeneousvols, const std::vector< Real > &correlations, Real w0, Real w1, Real targetVariance, Real tolerance, Real alphaMax, Real alphaMin, Integer steps, Real &alpha, Real &a, Real &b, std::vector< Volatility > &ratetwovols)
bool finalPart(Real alphaFound, Integer stepindex, const std::vector< Volatility > &ratetwohomogeneousvols, Real quadraticPart, Real linearPart, Real constantPart, Real &alpha, Real &a, Real &b, std::vector< Volatility > &ratetwovols)
bool solve(Real alpha0, Integer stepindex, const std::vector< Volatility > &rateonevols, const std::vector< Volatility > &ratetwohomogeneousvols, const std::vector< Real > &correlations, Real w0, Real w1, Real targetVariance, Real tolerance, Real alphaMax, Real alphaMin, Integer steps, Real &alpha, Real &a, Real &b, std::vector< Volatility > &ratetwovols)
ext::shared_ptr< AlphaForm > parametricform_
Definition: alphafinder.hpp:84
Real computeQuadraticPart(Real alpha)
std::vector< Volatility > rateonevols_
Definition: alphafinder.hpp:86
std::vector< Real > correlations_
Definition: alphafinder.hpp:88
Real computeLinearPart(Real alpha)
std::vector< Volatility > putativevols_
Definition: alphafinder.hpp:87
QL_REAL Real
real number
Definition: types.hpp:50
QL_INTEGER Integer
integer number
Definition: types.hpp:35
Definition: any.hpp:35