QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
lmmnormaldriftcalculator.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 Giorgio Facchinetti
5 Copyright (C) 2007 Chiara Fornarola
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/*! \file lmmnormaldriftcalculator.hpp
22 \brief Drift computation for normal Libor market model
23*/
24
25#ifndef quantlib_lmm_normal_drift_calculator_hpp
26#define quantlib_lmm_normal_drift_calculator_hpp
27
28#include <ql/math/matrix.hpp>
30#include <vector>
31
32namespace QuantLib {
33
34 //! Drift computation for normal %Libor market models
35 /*! Returns the drift \f$ \mu \Delta t \f$.
36 See Mark Joshi, <i>Rapid Computation of Drifts in a
37 Reduced Factor Libor Market Model</i>, Wilmott Magazine,
38 May 2003.
39 */
41 public:
42 LMMNormalDriftCalculator(const Matrix& pseudo,
43 const std::vector<Time>& taus,
44 Size numeraire,
45 Size alive);
46 //! Computes the drifts
47 void compute(const LMMCurveState& cs,
48 std::vector<Real>& drifts) const;
49 void compute(const std::vector<Rate>& fwds,
50 std::vector<Real>& drifts) const;
51
52 /*! Computes the drifts without factor reduction as in
53 eqs. 2, 4 of ref. [1], modified for normal forward rates dynamic
54 (uses the covariance matrix directly). */
55 void computePlain(const LMMCurveState& cs,
56 std::vector<Real>& drifts) const;
57 void computePlain(const std::vector<Rate>& fwds,
58 std::vector<Real>& drifts) const;
59
60 /*! Computes the drifts with factor reduction as in
61 eq. 7 of ref. [1], modified for normal forward rates dynamic
62 (uses pseudo square root of the covariance matrix). */
63 void computeReduced(const LMMCurveState& cs,
64 std::vector<Real>& drifts) const;
65 void computeReduced(const std::vector<Rate>& fwds,
66 std::vector<Real>& drifts) const;
67
68
69 private:
73 std::vector<Real> oneOverTaus_;
75 // temporary variables to be added later
76 mutable std::vector<Real> tmp_;
77 mutable Matrix e_;
78 std::vector<Size> downs_, ups_;
79 };
80
81}
82
83#endif
Curve state for Libor market models
Drift computation for normal Libor market models.
void computePlain(const LMMCurveState &cs, std::vector< Real > &drifts) const
void compute(const LMMCurveState &cs, std::vector< Real > &drifts) const
Computes the drifts.
void computeReduced(const LMMCurveState &cs, std::vector< Real > &drifts) const
Matrix used in linear algebra.
Definition: matrix.hpp:41
std::size_t Size
size of a container
Definition: types.hpp:58
matrix used in linear algebra.
Definition: any.hpp:35