QuantLib
: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
ql
math
matrixutilities
symmetricschurdecomposition.hpp
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*
4
Copyright (C) 2003 Ferdinando Ametrano
5
Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl
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
25
#ifndef quantlib_math_jacobi_decomposition_h
26
#define quantlib_math_jacobi_decomposition_h
27
28
#include <ql/math/matrix.hpp>
29
30
namespace
QuantLib
{
31
33
50
class
SymmetricSchurDecomposition
{
51
public
:
53
SymmetricSchurDecomposition
(
const
Matrix
&s);
54
const
Array
&
eigenvalues
()
const
{
return
diagonal_
; }
55
const
Matrix
&
eigenvectors
()
const
{
return
eigenVectors_
; }
56
private
:
57
Array
diagonal_
;
58
Matrix
eigenVectors_
;
59
void
jacobiRotate_
(
Matrix
& m,
Real
rot,
Real
dil,
60
Size
j1,
Size
k1,
Size
j2,
Size
k2)
const
;
61
};
62
63
64
// inline definitions
65
67
inline
void
SymmetricSchurDecomposition::jacobiRotate_
(
68
Matrix
&m,
Real
rot,
Real
dil,
Size
j1,
69
Size
k1,
Size
j2,
Size
k2)
const
{
70
Real
x1, x2;
71
x1 = m[j1][k1];
72
x2 = m[j2][k2];
73
m[j1][k1] = x1 - dil*(x2 + x1*rot);
74
m[j2][k2] = x2 + dil*(x1 - x2*rot);
75
}
76
77
}
78
79
80
#endif
81
82
QuantLib::Array
1-D array used in linear algebra.
Definition:
array.hpp:52
QuantLib::Matrix
Matrix used in linear algebra.
Definition:
matrix.hpp:41
QuantLib::SymmetricSchurDecomposition
symmetric threshold Jacobi algorithm.
Definition:
symmetricschurdecomposition.hpp:50
QuantLib::SymmetricSchurDecomposition::eigenVectors_
Matrix eigenVectors_
Definition:
symmetricschurdecomposition.hpp:58
QuantLib::SymmetricSchurDecomposition::jacobiRotate_
void jacobiRotate_(Matrix &m, Real rot, Real dil, Size j1, Size k1, Size j2, Size k2) const
This routines implements the Jacobi, a.k.a. Givens, rotation.
Definition:
symmetricschurdecomposition.hpp:67
QuantLib::SymmetricSchurDecomposition::eigenvectors
const Matrix & eigenvectors() const
Definition:
symmetricschurdecomposition.hpp:55
QuantLib::SymmetricSchurDecomposition::eigenvalues
const Array & eigenvalues() const
Definition:
symmetricschurdecomposition.hpp:54
QuantLib::SymmetricSchurDecomposition::diagonal_
Array diagonal_
Definition:
symmetricschurdecomposition.hpp:57
QuantLib::Real
QL_REAL Real
real number
Definition:
types.hpp:50
QuantLib::Size
std::size_t Size
size of a container
Definition:
types.hpp:58
QuantLib
Definition:
any.hpp:35
Generated by
Doxygen
1.9.5