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 |
I am sorry, the context diff is obviously wrong - it should be:
*** pathwisediscounter.cpp.orig 2009-12-30 10:57:50.000000000 +0100 --- pathwisediscounter.cpp 2010-12-21 09:32:05.000000000 +0100 *************** *** 57,62 **** --- 57,64 ---- 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; ------------------------------------------------------------------------------ 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 |
In reply to this post by Andreas Spengler-2
On Tue, 2010-12-21 at 08:37 +0100, Andreas Spengler wrote:
> 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_). Andreas, I'm not sure, but I think it was a common theme of the market-model implementation that vectors should be initialized at the correct size by the calling code before being passed to methods (efficiency reasons and such.) Adding a resize() shouldn't cost much, but I'd leave the decision to Mark Joshi as he's the main developer of that part of the library (Mark, are you reading this? Any thoughts?) Luigi -- When all else fails, pour a pint of Guinness in the gas tank, advance the spark 20 degrees, cry "God Save the Queen!", and pull the starter knob. -- MG "Series MGA" Workshop Manual ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Hi Luigi,
Am 24.12.2010 11:01, schrieb Luigi Ballabio: > Andreas, > I'm not sure, but I think it was a common theme of the market-model > implementation that vectors should be initialized at the correct size by > the calling code before being passed to methods (efficiency reasons and > such.) Adding a resize() shouldn't cost much, but I'd leave the > decision to Mark Joshi as he's the main developer of that part of the > library (Mark, are you reading this? Any thoughts?) Agreed. The point here, however, is that the calling object (PathwiseAccountingEngine), initializes the factor variable to be of size "numberOfProducts"... Rgds, Andreas ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
In reply to this post by Andreas Spengler-2
I am on holiday right now.
Andreas is probably right. I'll look into it when I get back to the office. Happy Solstice! Mark -- Prof Mark Joshi Centre for Actuarial Studies University of Melbourne My website is www.markjoshi.com ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
i have put a fix into PathwiseAccountingEngine
regards Mark On 27 December 2010 07:24, Mark joshi <[hidden email]> wrote: I am on holiday right now. -- Prof Mark Joshi Centre for Actuarial Studies University of Melbourne My website is www.markjoshi.com ------------------------------------------------------------------------------ Gaining the trust of online customers is vital for the success of any company that requires sensitive data to be transmitted over the Web. Learn how to best implement a security strategy that keeps consumers' information secure and instills the confidence they need to proceed with transactions. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Free forum by Nabble | Edit this page |