Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

FastPredictorCorrectorLMM.h

Go to the documentation of this file.
00001 /* WARANTY NOTICE AND COPYRIGHT
00002 This program is free software; you can redistribute it and/or
00003 modify it under the terms of the GNU General Public License
00004 as published by the Free Software Foundation; either version 2
00005 of the License, or (at your option) any later version.
00006 
00007 This program is distributed in the hope that it will be useful,
00008 but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 GNU General Public License for more details.
00011 
00012 You should have received a copy of the GNU General Public License
00013 along with this program; if not, write to the Free Software
00014 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00015 
00016 Copyright (C) Michael J. Meyer
00017 
00018 matmjm@mindspring.com
00019 spyqqqdia@yahoo.com
00020 
00021 */
00022 
00023 
00024 /*
00025  * FastPredictorCorrectorLMM.h
00026  *
00027  * Created on April 10, 2003, 9:00 PM
00028  */
00029 
00030 #ifndef martingale_fastpclmm_h    
00031 #define martingale_fastpclmm_h
00032 
00033 #include "TypedefsMacros.h"
00034 #include "LiborMarketModel.h"               // base class
00035 #include "Matrix.h"                         // direct members
00036 
00037 MTGL_BEGIN_NAMESPACE(Martingale)
00038 
00039 
00040 
00041 // dependenies
00042 class StochasticGenerator;       // StochasticGenerator.h
00043 class SobolLiborDriver;
00044 class MonteCarloLiborDriver;
00045 class LiborFactorLoading;        // LiborFactorLoading.h
00046 // class UTRRealMatrix;
00047 // class RealArray1D;
00048 // class RealVector;
00049 
00050 
00051 
00060 /*******************************************************************************
00061  *
00062  *                                 FastPredictorCorrectorLMM
00063  *
00064  ******************************************************************************/ 
00065 
00074 class FastPredictorCorrectorLMM : public LiborMarketModel {
00075 
00076         
00077         // Row t is used to drive the time step T_t->T_{t+1}
00078         // This is allocated as an n-dimensional matrix to preserve natural indexation
00079         // Row index starts at zero, first column not needed, see newWienerIncrements.
00080         UTRRealMatrix Z;
00081     
00082     // The following are allocated as lower triangular arrays:
00083     
00084     // Array containing the X-Libors X(t,j)=X_j(T_t)=delta_jL_j(T_t), t<=j.
00085     // The rows are the vectors X(T_t)=(X_t(T_t),...,X_{n-1}(T_t)).
00086     UTRRealMatrix X;
00087     
00088     // Array containing the log-Libors Y(t,j)=Y_j(T_t)=log(X_j(T_t)), t<=j.
00089     // The rows are the vectors Y(T_t)=(Y_t(T_t),...,Y_{n-1}(T_t)).
00090     UTRRealMatrix Y;
00091         
00092         // Array containing the deterministic drift step approximations
00093     // m0(t,j)=integral_{T_t}^{T_{t+1}}mu_j(s)ds, where mu_j(s) is the 
00094         // instantaneous drift of X_j computed approximating X_k(s)/(1+X_k(s)) 
00095         // with X_k(0)/(1+X_k(0)).
00096     UTRRealMatrix m0;
00097 
00098     // drift step vector
00099     RealArray1D m;
00100     
00101     // volatility step vector
00102     RealArray1D V;
00103     
00104     // vector used to store factors G_j(t)=0.5*[F_j(t)+F_j(t+1)] where 
00105         // F_j(t)=X_j(t)/(1+X_j(t)).
00106     RealArray1D G;
00107     
00108     // the log-Libor covariation matrices needed for the time steps
00109     UTRMatrixSequence logLiborCovariationMatrices;
00110                 
00111     // the upper triangular roots of the above log-Libor covariation matrices
00112     UTRMatrixSequence logLiborCovariationMatrixRoots;
00113         
00114         
00115     StochasticGenerator* SG;    // generates the Wiener increments driving the paths     
00116         
00117         RealVector XVec;         // cache for fast returning of X-Libor vectors.
00118 
00119 
00120 
00121 public:
00122 
00125     void switchToQMC();
00126         
00127         
00130     void switchToMC();
00131 
00132 
00133 
00134 // LIBORS
00135  
00141      Real XL(int j, int t) const;
00142          
00143          
00150      const RealVector& XLvect(int t, int p);
00151                  
00152 
00153         
00154 //  CONSTRUCTOR
00155 
00156     
00162     FastPredictorCorrectorLMM(LiborFactorLoading* fl);
00163         
00164         
00165         
00172         static LiborMarketModel* sample(int n, int volType, int corrType);
00173 
00174     
00175 
00176 // WIENER INCREMENTS
00177 
00182     void newWienerIncrements(int t);    
00183         
00187         void printWienerIncrements(int t, int s) const;
00188         
00189         
00199         int effectiveDimension(int t, int s) const { return (s-t)*(2*n-(1+t+s))/2; }
00200 
00201 
00202                 
00203                 
00204 // TIME STEP
00205 
00206     
00207 
00215      void timeStep(int t, int p);
00216                 
00217      
00224      void timeStep(int t){ timeStep(t,t+1); }
00225      
00226          
00227          
00228 // SWAPTION AND CAPLET AGGREGATE VOLATILITIES (SIGMA)
00229          
00237      Real capletAggregateVolatility(int i) const;
00238          
00239          
00248      Real swaptionAggregateVolatility(int p, int q, int t) const;
00249     
00250      
00251      
00252      
00253 // STRING MESSAGE
00254     
00255     
00258     std::ostream& printSelf(std::ostream& os) const;
00259          
00260 
00261 }; // end FastPredictorCorrectorLMM
00262 
00263 
00264 
00265 
00266 
00267 
00268 MTGL_END_NAMESPACE(Martingale)  
00269 
00270 #endif
00271 
00272 

Generated on Mon Sep 22 02:16:32 2003 for Libor-Library by doxygen1.3-rc3