diff --git a/ql/pricingengines/vanilla/analytichestonengine.cpp b/ql/pricingengines/vanilla/analytichestonengine.cpp index e434c07932f..c8165e95d90 100644 --- a/ql/pricingengines/vanilla/analytichestonengine.cpp +++ b/ql/pricingengines/vanilla/analytichestonengine.cpp @@ -126,40 +126,30 @@ namespace QuantLib { // helper class for integration class AnalyticHestonEngine::Fj_Helper { public: - Fj_Helper(const VanillaOption::arguments& arguments, - const ext::shared_ptr& model, - const AnalyticHestonEngine* engine, - ComplexLogFormula cpxLog, - Time term, - Real ratio, - Size j); - - Fj_Helper(Real kappa, - Real theta, - Real sigma, - Real v0, - Real s0, - Real rho, - const AnalyticHestonEngine* engine, - ComplexLogFormula cpxLog, - Time term, - Real strike, - Real ratio, - Size j); - - Fj_Helper(Real kappa, - Real theta, - Real sigma, - Real v0, - Real s0, - Real rho, - ComplexLogFormula cpxLog, - Time term, - Real strike, - Real ratio, - Size j); - - Real operator()(Real phi) const; + Fj_Helper(const VanillaOption::arguments& arguments, + const ext::shared_ptr& model, + const AnalyticHestonEngine* const engine, + ComplexLogFormula cpxLog, + Time term, Real ratio, Size j); + + Fj_Helper(Real kappa, Real theta, Real sigma, + Real v0, Real s0, Real rho, + const AnalyticHestonEngine* const engine, + ComplexLogFormula cpxLog, + Time term, + Real strike, + Real ratio, + Size j); + + Fj_Helper(Real kappa, Real theta, Real sigma, + Real v0, Real s0, Real rho, + ComplexLogFormula cpxLog, + Time term, + Real strike, + Real ratio, + Size j); + + Real operator()(Real phi) const; private: const Size j_; @@ -268,8 +258,8 @@ namespace QuantLib { std::sqrt(t1*t1 - sigma2_*phi *std::complex(-phi, (j_== 1)? 1 : -1)); const std::complex ex = std::exp(-d*term_); - const std::complex addOnTerm = - engine_ != 0 ? engine_->addOnTerm(phi, term_, j_) : Real(0.0); + const std::complex addOnTerm + = engine_ ? engine_->addOnTerm(phi, term_, j_) : Real(0.0); if (cpxLog_ == Gatheral) { if (phi != 0.0) { @@ -756,9 +746,10 @@ namespace QuantLib { } Size AnalyticHestonEngine::Integration::numberOfEvaluations() const { - if (integrator_ != 0) { + if (integrator_) { return integrator_->numberOfEvaluations(); - } else if (gaussianQuadrature_ != 0) { + } + else if (gaussianQuadrature_) { return gaussianQuadrature_->order(); } else { diff --git a/ql/pricingengines/vanilla/analytichestonengine.hpp b/ql/pricingengines/vanilla/analytichestonengine.hpp index 0094f1d38e7..6a7502052fb 100644 --- a/ql/pricingengines/vanilla/analytichestonengine.hpp +++ b/ql/pricingengines/vanilla/analytichestonengine.hpp @@ -127,15 +127,11 @@ namespace QuantLib { Real spotPrice, Real strikePrice, Real term, - Real kappa, - Real theta, - Real sigma, - Real v0, - Real rho, + Real kappa, Real theta, Real sigma, Real v0, Real rho, const TypePayoff& type, const Integration& integration, - ComplexLogFormula cpxLog, - const AnalyticHestonEngine* enginePtr, + const ComplexLogFormula cpxLog, + const AnalyticHestonEngine* const enginePtr, Real& value, Size& evaluations); diff --git a/test-suite/hestonmodel.cpp b/test-suite/hestonmodel.cpp index 78ef0fe37f7..d773e0fa2a5 100644 --- a/test-suite/hestonmodel.cpp +++ b/test-suite/hestonmodel.cpp @@ -2563,8 +2563,8 @@ void HestonModelTest::testPiecewiseTimeDependentComparison() { Real priceS = 0.0; for (Size j=0; j < 2; ++j) { - const sample_type& path1 = - (j & 1) != 0u ? firstPathGen.antithetic() : firstPathGen.next(); + const sample_type& path1 = (j&1) ? firstPathGen.antithetic() + : firstPathGen.next(); const Real spot1 = path1.value[0].back(); const Real v1 = path1.value[1].back(); @@ -2887,7 +2887,7 @@ void HestonModelTest::testSmallSigmaExpansion4ExpFitting() { const Real kappas[] = { 0.5, 1.0, 4.0 }; const Real thetas[] = { 0.04, 0.09}; const Real v0s[] = { 0.025, 0.20 }; - const Integer maturities[] = { 1, 31, 182, 1850 }; + const Real maturities[] = { 1, 31, 182, 1850 }; for (Size m=0; m < LENGTH(maturities); ++m) { const Date maturityDate = todaysDate + Period(maturities[m], Days); @@ -3058,8 +3058,9 @@ void HestonModelTest::testExponentialFitting4StrikesAndMaturities() { for (Size k=0; k < 2; ++k) { const ext::shared_ptr payoff = - ext::make_shared((k) != 0u ? Option::Put : Option::Call, - strike); + ext::make_shared( + (k) ? Option::Put : Option::Call, + strike); VanillaOption option(payoff, exercise); option.setPricingEngine(engine);