QuantLib
: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
ql
methods
montecarlo
multipath.hpp
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*
4
Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl
5
Copyright (C) 2003, 2004, 2005, 2006 StatPro Italia 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_montecarlo_multi_path_hpp
26
#define quantlib_montecarlo_multi_path_hpp
27
28
#include <ql/methods/montecarlo/path.hpp>
29
#include <utility>
30
31
namespace
QuantLib
{
32
34
39
class
MultiPath
{
40
public
:
41
MultiPath
() =
default
;
42
MultiPath
(
Size
nAsset,
43
const
TimeGrid
& timeGrid);
44
MultiPath
(std::vector<Path> multiPath);
46
47
Size
assetNumber
()
const
{
return
multiPath_
.size(); }
48
Size
pathSize
()
const
{
return
multiPath_
[0].length(); }
50
52
const
Path
&
operator[]
(
Size
j)
const
{
return
multiPath_
[j]; }
53
const
Path
&
at
(
Size
j)
const
{
return
multiPath_
.at(j); }
54
Path
&
operator[]
(
Size
j) {
return
multiPath_
[j]; }
55
Path
&
at
(
Size
j) {
return
multiPath_
.at(j); }
57
private
:
58
std::vector<Path>
multiPath_
;
59
};
60
61
62
// inline definitions
63
64
inline
MultiPath::MultiPath
(
Size
nAsset,
const
TimeGrid
& timeGrid)
65
: multiPath_(nAsset,
Path
(timeGrid)) {
66
QL_REQUIRE(nAsset > 0,
"number of asset must be positive"
);
67
}
68
69
inline
MultiPath::MultiPath
(std::vector<Path> multiPath) : multiPath_(
std
::move(multiPath)) {}
70
}
71
72
73
#endif
QuantLib::MultiPath
Correlated multiple asset paths.
Definition:
multipath.hpp:39
QuantLib::MultiPath::operator[]
const Path & operator[](Size j) const
Definition:
multipath.hpp:52
QuantLib::MultiPath::multiPath_
std::vector< Path > multiPath_
Definition:
multipath.hpp:58
QuantLib::MultiPath::operator[]
Path & operator[](Size j)
Definition:
multipath.hpp:54
QuantLib::MultiPath::at
const Path & at(Size j) const
Definition:
multipath.hpp:53
QuantLib::MultiPath::pathSize
Size pathSize() const
Definition:
multipath.hpp:48
QuantLib::MultiPath::MultiPath
MultiPath()=default
QuantLib::MultiPath::at
Path & at(Size j)
Definition:
multipath.hpp:55
QuantLib::MultiPath::assetNumber
Size assetNumber() const
Definition:
multipath.hpp:47
QuantLib::Path
single-factor random walk
Definition:
path.hpp:40
QuantLib::TimeGrid
time grid class
Definition:
timegrid.hpp:43
QuantLib::Size
std::size_t Size
size of a container
Definition:
types.hpp:58
QuantLib
Definition:
any.hpp:35
std
STL namespace.
Generated by
Doxygen
1.9.5