QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
tapcorrelations.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 François du Vignaud
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
21#ifndef quantlib_tap_correlations_hpp
22#define quantlib_tap_correlations_hpp
23
24#include <ql/functional.hpp>
25#include <ql/math/matrix.hpp>
27#include <ql/types.hpp>
28#include <utility>
29#include <vector>
30
31namespace QuantLib {
32
33 //! Returns the Triangular Angles Parametrized correlation matrix
34 /*! The matrix \f$ m \f$ is filled with values corresponding to angles
35 given in the \f$ angles \f$ vector. See equation (24) in
36 "Parameterizing correlations: a geometric interpretation"
37 by Francesco Rapisarda, Damiano Brigo, Fabio Mercurio
38
39 \test
40 - the correctness of the results is tested by reproducing
41 known good data.
42 - the correctness of the results is tested by checking
43 returned values against numerical calculations.
44 */
45 Matrix triangularAnglesParametrization(const Array& angles,
46 Size matrixSize,
47 Size rank);
48
49 Matrix lmmTriangularAnglesParametrization(const Array& angles,
50 Size matrixSize,
51 Size rank);
52
53 // the same function using the angles parameterized by the following
54 // transformation \f[ \teta_i = \frac{\Pi}{2} - arctan(x_i)\f]
56 Size matrixSize,
57 Size rank);
58
60 Size matrixSize,
61 Size rank);
62
63
64 //! Returns the rank reduced Triangular Angles Parametrized correlation matrix
65 /*! The matrix \f$ m \f$ is filled with values corresponding to angles
66 corresponding to the 3D spherical spiral parameterized by
67 \f$ alpha \f$, \f$ t0 \f$, \f$ epsilon \f$ values. See equation (32) in
68 "Parameterizing correlations: a geometric interpretation"
69 by Francesco Rapisarda, Damiano Brigo, Fabio Mercurio
70
71 \test
72 - the correctness of the results is tested by reproducing
73 known good data.
74 - the correctness of the results is tested by checking
75 returned values against numerical calculations.
76 */
78 Real t0,
79 Real epsilon,
80 Size nbRows);
81
82 // the same function with parameters packed in an Array
83 Matrix triangularAnglesParametrizationRankThreeVectorial(const Array& parameters,
84 Size nbRows);
85
86 // Cost function associated with Frobenius norm.
87 // <http://en.wikipedia.org/wiki/Matrix_norm>
89 public:
91 ext::function<Matrix(const Array&, Size, Size)> f,
92 Size matrixSize,
93 Size rank)
94 : target_(std::move(target)), f_(std::move(f)), matrixSize_(matrixSize), rank_(rank) {}
95 Real value(const Array& x) const override;
96 Array values(const Array& x) const override;
97
98 private:
100 ext::function<Matrix(const Array&, Size, Size)> f_;
103 };
104}
105
106#endif
1-D array used in linear algebra.
Definition: array.hpp:52
Cost function abstract class for optimization problem.
FrobeniusCostFunction(Matrix target, ext::function< Matrix(const Array &, Size, Size)> f, Size matrixSize, Size rank)
Real value(const Array &x) const override
method to overload to compute the cost function value in x
Array values(const Array &x) const override
method to overload to compute the cost function values in x
ext::function< Matrix(const Array &, Size, Size)> f_
Matrix used in linear algebra.
Definition: matrix.hpp:41
Optimization cost function class.
Maps function, bind and cref to either the boost or std implementation.
QL_REAL Real
real number
Definition: types.hpp:50
std::size_t Size
size of a container
Definition: types.hpp:58
matrix used in linear algebra.
Definition: any.hpp:35
Matrix lmmTriangularAnglesParametrization(const Array &angles, Size matrixSize, Size)
Matrix triangularAnglesParametrizationRankThree(Real alpha, Real t0, Real epsilon, Size matrixSize)
Returns the rank reduced Triangular Angles Parametrized correlation matrix.
Matrix triangularAnglesParametrization(const Array &angles, Size matrixSize, Size rank)
Returns the Triangular Angles Parametrized correlation matrix.
Matrix triangularAnglesParametrizationRankThreeVectorial(const Array &parameters, Size nbRows)
Matrix triangularAnglesParametrizationUnconstrained(const Array &x, Size matrixSize, Size rank)
Matrix lmmTriangularAnglesParametrizationUnconstrained(const Array &x, Size matrixSize, Size rank)
STL namespace.
Real alpha
Definition: sabr.cpp:200
Custom types.