QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
basisincompleteordered.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, 2008 Mark Joshi
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_basis_incomplete_ordered_hpp
22#define quantlib_basis_incomplete_ordered_hpp
23
24#include <ql/math/matrix.hpp>
25#include <valarray>
26
27namespace QuantLib {
28
30 public:
32 //! return value indicates if the vector was linearly independent
33 bool addVector(const Array& newVector);
34 Size basisSize() const;
37 private:
38 std::vector<Array> currentBasis_;
41 };
42
43/*! Given a collection of vectors, w_i, find a collection of vectors x_i such that
44x_i is orthogonal to w_j for i != j, and <x_i, w_i> = <w_i, w_i>
45
46This is done by performing GramSchmidt on the other vectors and then projecting onto
47the orthogonal space.
48
49This class is tested in
50
51 MatricesTest::testOrthogonalProjection();
52*/
53
55 {
56 public:
57 OrthogonalProjections(const Matrix& originalVectors,
58 Real multiplierCutOff,
59 Real tolerance );
60
61 const std::valarray<bool>& validVectors() const;
62 const std::vector<Real>& GetVector(Size index) const;
63
65
66
67 private:
68
69 //! inputs
75
76 //!outputs
77 std::valarray<bool> validVectors_;
78 std::vector<std::vector<Real> > projectedVectors_;
79
80 //!workspace
82
83
84 };
85
86}
87
88#endif
1-D array used in linear algebra.
Definition: array.hpp:52
bool addVector(const Array &newVector)
return value indicates if the vector was linearly independent
Matrix used in linear algebra.
Definition: matrix.hpp:41
const std::valarray< bool > & validVectors() const
const std::vector< Real > & GetVector(Size index) const
std::valarray< bool > validVectors_
outputs
std::vector< std::vector< Real > > projectedVectors_
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