QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
lmmdriftcalculator.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, 2007 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/*! \file lmmdriftcalculator.hpp
21 \brief Drift computation for Libor market model
22*/
23
24#ifndef quantlib_lmm_drift_calculator_hpp
25#define quantlib_lmm_drift_calculator_hpp
26
27#include <ql/math/matrix.hpp>
28#include <vector>
29
30namespace QuantLib {
31
32 class LMMCurveState;
33
34 //! Drift computation for log-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 LMMDriftCalculator(const Matrix& pseudo,
43 const std::vector<Spread>& displacements,
44 const std::vector<Time>& taus,
45 Size numeraire,
46 Size alive);
47 //! Computes the drifts
48 void compute(const LMMCurveState& cs,
49 std::vector<Real>& drifts) const;
50 void compute(const std::vector<Rate>& fwds,
51 std::vector<Real>& drifts) const;
52
53 /*! Computes the drifts without factor reduction as in
54 eqs. 2, 4 of ref. [1] (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 eq. 7 of ref. [1]
61 (uses pseudo square root of the covariance matrix). */
62 void computeReduced(const LMMCurveState& cs,
63 std::vector<Real>& drifts) const;
64 void computeReduced(const std::vector<Rate>& fwds,
65 std::vector<Real>& drifts) const;
66
67 private:
71 std::vector<Spread> displacements_;
72 std::vector<Real> oneOverTaus_;
74 // temporary variables to be added later
75 mutable std::vector<Real> tmp_;
76 mutable Matrix e_;
77 std::vector<Size> downs_, ups_;
78 };
79
80}
81
82#endif
Curve state for Libor market models
Drift computation for log-normal Libor market models.
std::vector< Spread > displacements_
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