1 /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 
3 /*
4 
5  Copyright (C) 2007 Mark Joshi
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 
22 #ifndef quantlib_ctsmm_caplet_calibration_periodic_hpp
23 #define quantlib_ctsmm_caplet_calibration_periodic_hpp
24 
25 
26 #include <ql/models/marketmodels/models/piecewiseconstantvariance.hpp>
27 #include <ql/models/marketmodels/models/volatilityinterpolationspecifier.hpp>
28 #include <ql/math/matrix.hpp>
29 #include <ql/models/marketmodels/curvestate.hpp>
30 #include <ql/models/marketmodels/evolutiondescription.hpp>
31 #include <ql/models/marketmodels/piecewiseconstantcorrelation.hpp>
32 #include <ql/shared_ptr.hpp>
33 #include <vector>
34 
35 namespace QuantLib {
36 
37 
38     Integer capletSwaptionPeriodicCalibration(
39         const EvolutionDescription& evolution,
40         const ext::shared_ptr<PiecewiseConstantCorrelation>& corr,
41         VolatilityInterpolationSpecifier& displacedSwapVariances,
42         const std::vector<Volatility>& capletVols,
43         const ext::shared_ptr<CurveState>& cs,
44         Spread displacement,
45         Real caplet0Swaption1Priority,
46         Size numberOfFactors,
47         Size period,
48         Size max1dIterations,
49         Real tolerance1d,
50         Size maxUnperiodicIterations,
51         Real toleranceUnperiodic,
52         Size maxPeriodIterations,
53         Real periodTolerance,
54         Real& deformationSize,                          // used to return information, not set yet
55         Real& totalSwaptionError,                       // ?
56         std::vector<Matrix>& swapCovariancePseudoRoots, // the thing we really want the pseudo root
57                                                         // for each time step
58         std::vector<Real>& finalScales,                 // scalings used for matching
59         Size& iterationsDone,                           // number of  period iteratations done
60         Real& errorImprovement,                         // improvement in error for last iteration
61         Matrix&
62             modelSwaptionVolsMatrix // the swaption vols calibrated to at each step of the iteration
63     );
64 }
65 
66 #endif
67