QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
tapcorrelations.hpp
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>
26#include <ql/math/optimization/costfunction.hpp>
27#include <ql/types.hpp>
28#include <utility>
29#include <vector>
30
31namespace QuantLib {
32
34
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
65
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
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
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.