QuantLib
: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
ql
math
matrixutilities
svd.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) 2003 Neil Firth
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
Adapted from the TNT project
20
http://math.nist.gov/tnt/download.html
21
22
This software was developed at the National Institute of Standards
23
and Technology (NIST) by employees of the Federal Government in the
24
course of their official duties. Pursuant to title 17 Section 105
25
of the United States Code this software is not subject to copyright
26
protection and is in the public domain. NIST assumes no responsibility
27
whatsoever for its use by other parties, and makes no guarantees,
28
expressed or implied, about its quality, reliability, or any other
29
characteristic.
30
31
We would appreciate acknowledgement if the software is incorporated in
32
redistributable libraries or applications.
33
34
*/
35
36
/*! \file svd.hpp
37
\brief singular value decomposition
38
*/
39
40
#ifndef quantlib_math_svd_h
41
#define quantlib_math_svd_h
42
43
#include <
ql/math/matrix.hpp
>
44
45
namespace
QuantLib
{
46
47
//! Singular value decomposition
48
/*! Refer to Golub and Van Loan: Matrix computation,
49
The Johns Hopkins University Press
50
51
\test the correctness of the returned values is tested by
52
checking their properties.
53
*/
54
class
SVD
{
55
public
:
56
// constructor
57
explicit
SVD
(
const
Matrix
&);
58
// results
59
const
Matrix
&
U
()
const
;
60
const
Matrix
&
V
()
const
;
61
const
Array
&
singularValues
()
const
;
62
Matrix
S
()
const
;
63
Real
norm2
()
const
;
64
Real
cond
()
const
;
65
Size
rank
()
const
;
66
// utilities
67
Array
solveFor
(
const
Array
&)
const
;
68
private
:
69
Matrix
U_
,
V_
;
70
Array
s_
;
71
Integer
m_
,
n_
;
72
bool
transpose_
;
73
};
74
75
}
76
77
78
#endif
79
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::SVD
Singular value decomposition.
Definition:
svd.hpp:54
QuantLib::SVD::V
const Matrix & V() const
Definition:
svd.cpp:489
QuantLib::SVD::singularValues
const Array & singularValues() const
Definition:
svd.cpp:493
QuantLib::SVD::S
Matrix S() const
Definition:
svd.cpp:497
QuantLib::SVD::U_
Matrix U_
Definition:
svd.hpp:69
QuantLib::SVD::U
const Matrix & U() const
Definition:
svd.cpp:485
QuantLib::SVD::s_
Array s_
Definition:
svd.hpp:70
QuantLib::SVD::norm2
Real norm2() const
Definition:
svd.cpp:508
QuantLib::SVD::solveFor
Array solveFor(const Array &) const
Definition:
svd.cpp:528
QuantLib::SVD::transpose_
bool transpose_
Definition:
svd.hpp:72
QuantLib::SVD::rank
Size rank() const
Definition:
svd.cpp:516
QuantLib::SVD::V_
Matrix V_
Definition:
svd.hpp:69
QuantLib::SVD::cond
Real cond() const
Definition:
svd.cpp:512
QuantLib::SVD::m_
Integer m_
Definition:
svd.hpp:71
QuantLib::SVD::n_
Integer n_
Definition:
svd.hpp:71
QuantLib::Real
QL_REAL Real
real number
Definition:
types.hpp:50
QuantLib::Integer
QL_INTEGER Integer
integer number
Definition:
types.hpp:35
QuantLib::Size
std::size_t Size
size of a container
Definition:
types.hpp:58
matrix.hpp
matrix used in linear algebra.
QuantLib
Definition:
any.hpp:35
Generated by
Doxygen
1.9.5