QuantLib
: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
ql
math
matrixutilities
gmres.hpp
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*
4
Copyright (C) 2017 Klaus Spanderen
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
24
#ifndef quantlib_gmres_hpp
25
#define quantlib_gmres_hpp
26
27
#include <ql/math/array.hpp>
28
#include <ql/functional.hpp>
29
30
#include <list>
31
32
namespace
QuantLib
{
33
49
struct
GMRESResult
{
50
std::list<Real>
errors
;
51
Array
x
;
52
};
53
54
class
GMRES
{
55
public
:
56
typedef
ext::function<
Array
(
const
Array
&)>
MatrixMult
;
57
58
GMRES
(
MatrixMult
A,
Size
maxIter,
Real
relTol,
MatrixMult
preConditioner =
MatrixMult
());
59
60
GMRESResult
solve
(
const
Array
& b,
const
Array
& x0 =
Array
())
const
;
61
GMRESResult
solveWithRestart
(
62
Size
restart,
const
Array
& b,
const
Array
& x0 =
Array
())
const
;
63
64
protected
:
65
GMRESResult
solveImpl
(
const
Array
& b,
const
Array
& x0)
const
;
66
67
const
MatrixMult
A_
,
M_
;
68
const
Size
maxIter_
;
69
const
Real
relTol_
;
70
};
71
72
}
73
74
#endif
QuantLib::Array
1-D array used in linear algebra.
Definition:
array.hpp:52
QuantLib::GMRES
Definition:
gmres.hpp:54
QuantLib::GMRES::solveWithRestart
GMRESResult solveWithRestart(Size restart, const Array &b, const Array &x0=Array()) const
Definition:
gmres.cpp:47
QuantLib::GMRES::A_
const MatrixMult A_
Definition:
gmres.hpp:67
QuantLib::GMRES::solve
GMRESResult solve(const Array &b, const Array &x0=Array()) const
Definition:
gmres.cpp:39
QuantLib::GMRES::relTol_
const Real relTol_
Definition:
gmres.hpp:69
QuantLib::GMRES::M_
const MatrixMult M_
Definition:
gmres.hpp:67
QuantLib::GMRES::maxIter_
const Size maxIter_
Definition:
gmres.hpp:68
QuantLib::GMRES::solveImpl
GMRESResult solveImpl(const Array &b, const Array &x0) const
Definition:
gmres.cpp:66
QuantLib::GMRES::MatrixMult
ext::function< Array(const Array &)> MatrixMult
Definition:
gmres.hpp:56
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
QuantLib::GMRESResult
Definition:
gmres.hpp:49
QuantLib::GMRESResult::errors
std::list< Real > errors
Definition:
gmres.hpp:50
QuantLib::GMRESResult::x
Array x
Definition:
gmres.hpp:51
Generated by
Doxygen
1.9.5