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

PredictorCorrectorLMM.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  * PredictorCorrectorLMM.h
00026  *
00027  * Created on April 10, 2003, 9:00 PM
00028  */
00029 
00030 #ifndef martingale_predictorcorrectorlmm_h    
00031 #define martingale_predictorcorrectorlmm_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 // dependencies
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 
00059 /*******************************************************************************
00060  *
00061  *                                 PredictorCorrectorLMM
00062  *
00063  ******************************************************************************/ 
00064 
00082 class PredictorCorrectorLMM : public LiborMarketModel {
00083 
00084         
00085         // Row t is used to drive the time step T_t->T_{t+1}
00086         // This is allocated as an n-dimensional matrix to preserve natural indexation
00087         // Row index starts at zero, first column not needed, see newWienerIncrements.
00088         UTRRealMatrix Z;
00089     
00090     // The following are allocated as lower triangular arrays:
00091     
00092     // Array containing the X-Libors X(t,j)=X_j(T_t)=delta_jL_j(T_t), t<=j.
00093     // The rows are the vectors X(T_t)=(X_t(T_t),...,X_{n-1}(T_t)).
00094     UTRRealMatrix X;
00095     
00096     // Array containing the log-Libors Y(t,j)=Y_j(T_t)=log(X_j(T_t)), t<=j.
00097     // The rows are the vectors Y(T_t)=(Y_t(T_t),...,Y_{n-1}(T_t)).
00098     UTRRealMatrix Y;
00099 
00100     // drift step vector
00101     RealArray1D m;
00102     
00103     // volatility step vector
00104     RealArray1D V;
00105     
00106     // vector used to store factors X_j(t)/(1+X_j(t)) during time steps
00107     RealArray1D F;
00108     
00109     // the log-Libor covariation matrices needed for the time steps
00110     UTRMatrixSequence logLiborCovariationMatrices;
00111                 
00112     // the upper triangular roots of the above log-Libor covariation matrices
00113     UTRMatrixSequence logLiborCovariationMatrixRoots;
00114         
00115         
00116     StochasticGenerator* SG;    // generates the Wiener increments driving the paths     
00117         
00118         RealVector XVec;          // cache for fast returning of X-Libor vectors.
00119 
00120 
00121 
00122 public:
00123 
00126     void switchToQMC();
00127         
00128         
00131     void switchToMC();
00132         
00133 
00134 
00135 
00136 // LIBORS
00137 
00138      
00144      Real XL(int j, int t) const;
00145          
00146          
00153      const RealVector& XLvect(int t, int p);
00154                  
00155 
00156         
00157 //  CONSTRUCTOR
00158 
00159     
00165     PredictorCorrectorLMM(LiborFactorLoading* fl);      
00166         
00167                 
00174         static LiborMarketModel* sample(int n, int volType, int corrType);
00175     
00176 
00177     
00178 
00179 // WIENER INCREMENTS
00180 
00185     void newWienerIncrements(int t);    
00186                 
00190         void printWienerIncrements(int t, int s) const;
00191         
00192         
00202         int effectiveDimension(int t, int s) const { return (s-t)*(2*n-(1+t+s))/2; }
00203 
00204 
00205                 
00206                 
00207 // TIME STEP
00208 
00209     
00210 
00218      void timeStep(int t, int p);
00219                 
00220      
00227      void timeStep(int t){ timeStep(t,t+1); }
00228      
00229 
00230          
00231 // SWAPTION AND CAPLET AGGREGATE VOLATILITIES (SIGMA)
00232          
00240     Real capletAggregateVolatility(int i) const;
00241          
00242          
00251     Real swaptionAggregateVolatility(int p, int q, int t)  const;
00252     
00253      
00254      
00255      
00256 // STRING MESSAGE
00257 
00259    std::ostream& printSelf(std::ostream& os) const;
00260          
00261              
00262 
00263 
00264 }; // end PredictorCorrectorLMM
00265 
00266 
00267 
00268 
00269 
00270 MTGL_END_NAMESPACE(Martingale)  
00271 
00272 #endif
00273 
00274 

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