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

FactorLoading.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 
00026 #ifndef martingale_factorloading_h    
00027 #define martingale_factorloading_h
00028 
00029 #include "TypedefsMacros.h"
00030 #include "Matrix.h"                   // direct members
00031 
00032 MTGL_BEGIN_NAMESPACE(Martingale)
00033 
00034 
00035 
00036 // dependencies
00037 class std::ostream;
00038 // class UTRRealMatrix;
00039 // class RealMatrix;
00040 // class RealArray1D;
00041 
00042 
00043 
00049 /*******************************************************************************
00050  *
00051  *                     Class: FactorLoading
00052  * 
00053  ******************************************************************************/
00054 
00055 
00093 class FactorLoading {
00094 
00095 protected:
00096         
00097     int n;         // dimension of Y
00098     
00099         
00100 public:
00101     
00102 // ACCESSORS
00103     
00107     int getDimension() const { return n; }
00108 
00109     
00110     
00111 // CONSTRUCTOR
00112         
00113  
00114         
00118    FactorLoading(int dim) : n(dim) {  }
00119         
00120         
00121 // CORRELATIONS, VOLATILITIES, LOG-COVARIATION INTEGRALS
00122 
00125    virtual Real rho(int i, int j) const = 0;
00126    
00132    virtual Real sigma(int i, Real t) const = 0;
00133    
00140    virtual Real 
00141    integral_sgi_sgj_rhoij(int i, int j, Real t, Real T) const = 0;
00142    
00143    
00145         virtual std::ostream& printSelf(std::ostream& os) const = 0;
00146  
00147  
00148 // CORRELATION OF RETURNS
00149 
00151    const UTRRealMatrix& correlationMatrix() const;
00152 
00153 
00154 // LOG-COVARIATION MATRICES
00155    
00160    const UTRRealMatrix&
00161    covariationMatrix(int p,int q, Real t, Real T) const;
00162    
00163    
00168    const UTRRealMatrix&
00169    covariationMatrix(Real t, Real T) const;
00170    
00171 
00172     
00178    const UTRRealMatrix& nu(Real t, int p) const;
00179 
00180    
00181 }; // end FactorLoading
00182 
00183 
00184 
00185 
00186 /*******************************************************************************
00187  *
00188  *            Constant volatility-correlation factor loading
00189  *
00190  ******************************************************************************/
00191 
00192 
00196 class ConstantFactorLoading : public FactorLoading {
00197         
00198    UTRRealMatrix corr;          // the correlations rho_ij
00199    RealArray1D sg;              // the volatilities sigma_i
00200         
00201 public:
00202         
00207         ConstantFactorLoading(int dim, const RealArray1D& vols, const UTRRealMatrix& rho) :
00208         FactorLoading(dim), corr(rho), sg(vols) {  }
00209         
00210         virtual ~ConstantFactorLoading(){ }
00211 
00212         
00213 // CORRELATIONS, VOLATILITIES, LOG-COVARIATION INTEGRALS
00214         
00217    Real rho(int i, int j) const;
00218         
00220    const UTRRealMatrix& getCorrelationMatrix(){ return corr; }
00221         
00223    const RealArray1D& getVols() const { return sg; }
00224             
00230    Real sigma(int i, Real t) const;
00231    
00232 
00233 // COVARIATION INTEGRALS CONTROLLING THE TIME STEPS
00234    
00241    Real 
00242    integral_sgi_sgj_rhoij(int i, int j, Real t, Real T) const;
00243    
00244 
00245    
00246 // PSEUDO SQUARE ROOTS OF THE CORRELATION MATRIX
00247    
00251    const UTRRealMatrix& correlationMatrixRoot();
00252    
00253    
00258    const RealMatrix& correlationMatrixRankReducedRoot(int r);
00259    
00260    
00264    std::ostream& printSelf(std::ostream& os) const;
00265         
00266 }; // end ConstantFactorLoading
00267 
00268 
00269 
00270 
00271 
00272 MTGL_END_NAMESPACE(Martingale)
00273 
00274 #endif

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