QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
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
45namespace 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:
73 };
74
75}
76
77
78#endif
79
1-D array used in linear algebra.
Definition: array.hpp:52
Matrix used in linear algebra.
Definition: matrix.hpp:41
Singular value decomposition.
Definition: svd.hpp:54
const Matrix & V() const
Definition: svd.cpp:489
const Array & singularValues() const
Definition: svd.cpp:493
Matrix S() const
Definition: svd.cpp:497
Matrix U_
Definition: svd.hpp:69
const Matrix & U() const
Definition: svd.cpp:485
Array s_
Definition: svd.hpp:70
Real norm2() const
Definition: svd.cpp:508
Array solveFor(const Array &) const
Definition: svd.cpp:528
bool transpose_
Definition: svd.hpp:72
Size rank() const
Definition: svd.cpp:516
Matrix V_
Definition: svd.hpp:69
Real cond() const
Definition: svd.cpp:512
Integer m_
Definition: svd.hpp:71
Integer n_
Definition: svd.hpp:71
QL_REAL Real
real number
Definition: types.hpp:50
QL_INTEGER Integer
integer number
Definition: types.hpp:35
std::size_t Size
size of a container
Definition: types.hpp:58
matrix used in linear algebra.
Definition: any.hpp:35