QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
lognormalfwdrateeuler.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) 2006 Ferdinando Ametrano
5 Copyright (C) 2006 Mark Joshi
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
21#ifndef quantlib_forward_rate_euler_evolver_hpp
22#define quantlib_forward_rate_euler_evolver_hpp
23
26
27namespace QuantLib {
28
29 class MarketModel;
30 class BrownianGenerator;
31 class BrownianGeneratorFactory;
32 class LMMDriftCalculator;
33
34 //! Euler
36 public:
37 LogNormalFwdRateEuler(const ext::shared_ptr<MarketModel>&,
39 const std::vector<Size>& numeraires,
40 Size initialStep = 0);
41 //! \name MarketModel interface
42 //@{
43 const std::vector<Size>& numeraires() const override;
44 Real startNewPath() override;
45 Real advanceStep() override;
46 Size currentStep() const override;
47 const CurveState& currentState() const override;
48 void setInitialState(const CurveState&) override;
49 //@}
50
51 //! accessor methods useful for doing pathwise vegas
52 const std::vector<Real>& browniansThisStep() const
53 {
54 return brownians_;
55 }
56
57
58
59 private:
60 void setForwards(const std::vector<Real>& forwards);
61 // inputs
62 ext::shared_ptr<MarketModel> marketModel_;
63 std::vector<Size> numeraires_;
65 ext::shared_ptr<BrownianGenerator> generator_;
66 // fixed variables
67 std::vector<std::vector<Real> > fixedDrifts_;
68 // working variables
73 std::vector<Real> drifts1_, initialDrifts_;
74 std::vector<Real> brownians_, correlatedBrownians_;
75 std::vector<Size> alive_;
76 // helper classes
77 std::vector<LMMDriftCalculator> calculators_;
78 };
79
80}
81
82#endif
Curve state for market-model simulations
Definition: curvestate.hpp:41
Curve state for Libor market models
const CurveState & currentState() const override
void setForwards(const std::vector< Real > &forwards)
const std::vector< Real > & browniansThisStep() const
accessor methods useful for doing pathwise vegas
std::vector< std::vector< Real > > fixedDrifts_
ext::shared_ptr< MarketModel > marketModel_
const std::vector< Size > & numeraires() const override
std::vector< LMMDriftCalculator > calculators_
ext::shared_ptr< BrownianGenerator > generator_
void setInitialState(const CurveState &) override
Market-model evolver.
Definition: evolver.hpp:35
QL_REAL Real
real number
Definition: types.hpp:50
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35