Skip to content

Commit

Permalink
Small fixes for AAD (lballabio#2056)
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio authored Aug 12, 2024
2 parents 897ddbe + f05e6dc commit 6ba32c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions ql/experimental/credit/spotlosslatentmodel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ namespace QuantLib {
{
Real sumMs =
std::inner_product(this->factorWeights_[iName].begin(),
this->factorWeights_[iName].end(), m.begin(), 0.);
this->factorWeights_[iName].end(), m.begin(), Real(0.));
Real res = this->cumulativeZ((invCumYProb - sumMs) /
this->idiosyncFctrs_[iName] );
#if defined(QL_EXTRA_SAFETY_CHECKS)
Expand Down Expand Up @@ -236,12 +236,12 @@ namespace QuantLib {
//Size iRR = iName + basket_->size();// should be live pool
const Real sumMs =
std::inner_product(fctrs_[iName].begin(), fctrs_[iName].end(),
mktFactors.begin(), 0.);
mktFactors.begin(), Real(0.));
const Real sumBetaLoss =
std::inner_product(fctrs_[iName + numNames_].begin(),
fctrs_[iName + numNames_].end(),
fctrs_[iName + numNames_].begin(),
0.);
Real(0.));
return this->cumulativeZ((sumMs + std::sqrt(1.-crossIdiosyncFctrs_[iName])
* std::sqrt(1.+modelA_*modelA_) *
invUncondRR
Expand All @@ -264,7 +264,7 @@ namespace QuantLib {
basket_->defaultKeys()[iName]);
const Probability pdef = dfts->defaultProbability(d, true);
// before asking for -\infty
if (pdef < 1.e-10) return 0.;
if (pdef < 1.e-10) return Real(0.);

Size iRecovery = iName + numNames_;// should be live pool
return cumulativeY(
Expand Down Expand Up @@ -361,7 +361,7 @@ namespace QuantLib {
\sum_k a^2_{i,k} a^2_{N+i,k}
*/
{
Real cumul = 0.;
Real cumul = Real(0.);
for(Size iB=0; iB<factorWeights[iName].size(); iB++)
// actually this size is unique
cumul += factorWeights[iName][iB] *
Expand Down
2 changes: 1 addition & 1 deletion ql/pricingengines/blackformula.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ namespace QuantLib {

namespace {

boost::math::normal_distribution<double> normal_dist;
boost::math::normal_distribution<Real> normal_dist;

Real phi(const Real x) {
return boost::math::pdf(normal_dist, x);
Expand Down

0 comments on commit 6ba32c7

Please sign in to comment.