Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ fixes and missing implementations #1957

Merged
merged 2 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ql/experimental/commodities/commoditycurve.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@ namespace QuantLib {
return c1.name() == c2.name();
}

inline const CommodityType& CommodityCurve::commodityType() const {
return commodityType_;
}

inline const UnitOfMeasure& CommodityCurve::unitOfMeasure() const {
return unitOfMeasure_;
}

inline const Currency& CommodityCurve::currency() const {
return currency_;
}

inline const std::string& CommodityCurve::name() const {
return name_;
}
Expand Down
4 changes: 2 additions & 2 deletions ql/experimental/credit/defaultevent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ namespace QuantLib {
Currency curr,
Seniority bondsSen,
// Settlement information:
const Date& settleDate = Null<Date>(),
Real recoveryRate = 0.4);
const Date& settleDate,
Real recoveryRate);

Date date() const override;
bool isRestructuring() const { return eventType_.isRestructuring(); }
Expand Down
15 changes: 8 additions & 7 deletions ql/experimental/finitedifferences/fdmvppstepcondition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <ql/methods/finitedifferences/stepcondition.hpp>
#include <ql/shared_ptr.hpp>
#include <ql/functional.hpp>
#include <ql/methods/finitedifferences/utilities/fdminnervaluecalculator.hpp>
#include <vector>

namespace QuantLib {
Expand All @@ -35,16 +36,16 @@ namespace QuantLib {
class FdmInnerValueCalculator;

struct FdmVPPStepConditionParams {
const Real heatRate;
const Real pMin; const Real pMax;
const Size tMinUp; const Size tMinDown;
const Real startUpFuel; const Real startUpFixCost;
const Real fuelCostAddon;
Real heatRate;
Real pMin; Real pMax;
Size tMinUp; Size tMinDown;
Real startUpFuel; Real startUpFixCost;
Real fuelCostAddon;
};

struct FdmVPPStepConditionMesher {
const Size stateDirection;
const ext::shared_ptr<FdmMesher> mesher;
Size stateDirection;
ext::shared_ptr<FdmMesher> mesher;
};

class FdmVPPStepCondition : public StepCondition<Array> {
Expand Down
8 changes: 4 additions & 4 deletions ql/experimental/math/latentmodel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ namespace QuantLib {
explicit LatentModel(
const std::vector<std::vector<Real> >& factorsWeights,
const typename copulaType::initTraits& ini =
copulaType::initTraits());
typename copulaType::initTraits());
/*! Constructs a LM with an arbitrary number of latent variables
depending only on one random factor but contributing to each latent
variable through different weights.
Expand All @@ -524,7 +524,7 @@ namespace QuantLib {
*/
explicit LatentModel(const std::vector<Real>& factorsWeight,
const typename copulaType::initTraits& ini =
copulaType::initTraits());
typename copulaType::initTraits());
/*! Constructs a LM with an arbitrary number of latent variables
depending only on one random factor with the same weight for all
latent variables.
Expand All @@ -538,7 +538,7 @@ namespace QuantLib {
*/
explicit LatentModel(Real correlSqr,
Size nVariables,
const typename copulaType::initTraits& ini = copulaType::initTraits());
const typename copulaType::initTraits& ini = typename copulaType::initTraits());
/*! Constructs a LM with an arbitrary number of latent variables
depending only on one random factor with the same weight for all
latent variables. The weight is observed and this constructor is
Expand All @@ -554,7 +554,7 @@ namespace QuantLib {
explicit LatentModel(const Handle<Quote>& singleFactorCorrel,
Size nVariables,
const typename copulaType::initTraits& ini =
copulaType::initTraits());
typename copulaType::initTraits());

//! Provides values of the factors \f$ a_{i,k} \f$
const std::vector<std::vector<Real> >& factorWeights() const {
Expand Down
6 changes: 6 additions & 0 deletions ql/experimental/volatility/zabrinterpolatedsmilesection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ inline Real ZabrInterpolatedSmileSection<Evaluation>::rho() const {
return zabrInterpolation_->rho();
}

template <typename Evaluation>
inline Real ZabrInterpolatedSmileSection<Evaluation>::gamma() const {
calculate();
return zabrInterpolation_->gamma();
}

template <typename Evaluation>
inline Real ZabrInterpolatedSmileSection<Evaluation>::rmsError() const {
calculate();
Expand Down
28 changes: 14 additions & 14 deletions ql/models/equity/hestonslvfdmmodel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,33 @@ class SimpleQuote;
class LocalVolTermStructure;

struct HestonSLVFokkerPlanckFdmParams {
const Size xGrid, vGrid;
const Size tMaxStepsPerYear, tMinStepsPerYear;
const Real tStepNumberDecay;
Size xGrid, vGrid;
Size tMaxStepsPerYear, tMinStepsPerYear;
Real tStepNumberDecay;

// Rannacher smoothing steps at the beginning
const Size nRannacherTimeSteps;
Size nRannacherTimeSteps;

const Size predictionCorretionSteps;
Size predictionCorretionSteps;

// local volatility forward equation
const Real x0Density;
const Real localVolEpsProb;
const Size maxIntegrationIterations;
Real x0Density;
Real localVolEpsProb;
Size maxIntegrationIterations;

// variance mesher definition
const Real vLowerEps, vUpperEps, vMin;
const Real v0Density, vLowerBoundDensity, vUpperBoundDensity;
Real vLowerEps, vUpperEps, vMin;
Real v0Density, vLowerBoundDensity, vUpperBoundDensity;

// do not calculate leverage function if prob is smaller than eps
const Real leverageFctPropEps;
Real leverageFctPropEps;

// algorithm to get to the start configuration at time point one
const FdmHestonGreensFct::Algorithm greensAlgorithm;
const FdmSquareRootFwdOp::TransformationType trafoType;
FdmHestonGreensFct::Algorithm greensAlgorithm;
FdmSquareRootFwdOp::TransformationType trafoType;

// define finite difference scheme
const FdmSchemeDesc schemeDesc;
FdmSchemeDesc schemeDesc;
};

class HestonSLVFDMModel : public LazyObject {
Expand Down
Loading