MarketModelPathwiseDiscounter::getFactors() does not resize factors vector

Posted by Andreas Spengler-2 on
URL: http://quantlib.414.s1.nabble.com/MarketModelPathwiseDiscounter-getFactors-does-not-resize-factors-vector-tp9362.html

Hi,

in trying to use QLs MarketModel classes for implementing a Target
Redemption Note, I found that MarketModelPathwiseDiscounter::getFactors()
does not resize the "factors" parameter properly before writing into it,
thereby overwriting members of the calling object in my environment (i.e.
PathwiseAccountingEngine::numberCashFlowsThisIndex_).

With the following change, the error is avoided:

*** pathwisediscounter.cpp      2010-12-21 08:28:38.000000000 +0100
--- pathwisediscounter.cpp.orig 2010-12-21 08:30:11.000000000 +0100
***************
*** 59,66 ****
      Real preDF = Discounts[currentStep][before_];
      Real postDF = Discounts[currentStep][before_+1];

-     factors.resize(numberRates_ + 1);
-
      for (Size i=before_+1; i<numberRates_; ++i)
          factors[i+1] =0.0;

--- 59,64 ----


Rgds,
Andreas


------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev