You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(17) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(23) |
| 2002 |
Jan
(18) |
Feb
(20) |
Mar
(22) |
Apr
(41) |
May
(28) |
Jun
(25) |
Jul
(10) |
Aug
(7) |
Sep
(5) |
Oct
(20) |
Nov
(13) |
Dec
(11) |
| 2003 |
Jan
(28) |
Feb
(5) |
Mar
(6) |
Apr
(5) |
May
(17) |
Jun
(6) |
Jul
(45) |
Aug
(35) |
Sep
(24) |
Oct
(50) |
Nov
(53) |
Dec
(6) |
| 2004 |
Jan
(4) |
Feb
(10) |
Mar
(52) |
Apr
(46) |
May
(8) |
Jun
(25) |
Jul
(12) |
Aug
(6) |
Sep
(8) |
Oct
(8) |
Nov
(9) |
Dec
(7) |
| 2005 |
Jan
(18) |
Feb
(60) |
Mar
(19) |
Apr
(26) |
May
(14) |
Jun
(27) |
Jul
(8) |
Aug
(15) |
Sep
(19) |
Oct
(53) |
Nov
(20) |
Dec
(23) |
| 2006 |
Jan
(16) |
Feb
(27) |
Mar
(33) |
Apr
(51) |
May
(36) |
Jun
(25) |
Jul
(54) |
Aug
(30) |
Sep
(25) |
Oct
(67) |
Nov
(43) |
Dec
(13) |
| 2007 |
Jan
(23) |
Feb
(27) |
Mar
(55) |
Apr
(79) |
May
(60) |
Jun
(66) |
Jul
(46) |
Aug
(30) |
Sep
(90) |
Oct
(49) |
Nov
(85) |
Dec
(74) |
| 2008 |
Jan
(68) |
Feb
(59) |
Mar
(64) |
Apr
(28) |
May
(66) |
Jun
(35) |
Jul
(73) |
Aug
(76) |
Sep
(65) |
Oct
(46) |
Nov
(41) |
Dec
(19) |
| 2009 |
Jan
(46) |
Feb
(90) |
Mar
(51) |
Apr
(104) |
May
(13) |
Jun
(24) |
Jul
(20) |
Aug
(39) |
Sep
(109) |
Oct
(101) |
Nov
(117) |
Dec
(57) |
| 2010 |
Jan
(55) |
Feb
(42) |
Mar
(39) |
Apr
(22) |
May
(33) |
Jun
(41) |
Jul
(25) |
Aug
(52) |
Sep
(75) |
Oct
(60) |
Nov
(62) |
Dec
(52) |
| 2011 |
Jan
(70) |
Feb
(31) |
Mar
(26) |
Apr
(28) |
May
(17) |
Jun
(38) |
Jul
(51) |
Aug
(35) |
Sep
(27) |
Oct
(35) |
Nov
(10) |
Dec
(20) |
| 2012 |
Jan
(21) |
Feb
(29) |
Mar
(13) |
Apr
(37) |
May
(33) |
Jun
(12) |
Jul
(34) |
Aug
(27) |
Sep
(29) |
Oct
(35) |
Nov
(58) |
Dec
(27) |
| 2013 |
Jan
(27) |
Feb
(16) |
Mar
(40) |
Apr
(16) |
May
(34) |
Jun
(37) |
Jul
(6) |
Aug
(3) |
Sep
(4) |
Oct
(49) |
Nov
(13) |
Dec
(12) |
| 2014 |
Jan
(15) |
Feb
(21) |
Mar
(11) |
Apr
(13) |
May
(27) |
Jun
(60) |
Jul
(19) |
Aug
(29) |
Sep
(20) |
Oct
(28) |
Nov
(41) |
Dec
(15) |
| 2015 |
Jan
(33) |
Feb
(29) |
Mar
(26) |
Apr
(17) |
May
(2) |
Jun
(13) |
Jul
(21) |
Aug
(30) |
Sep
(22) |
Oct
(15) |
Nov
(46) |
Dec
(20) |
| 2016 |
Jan
(6) |
Feb
(5) |
Mar
(9) |
Apr
(15) |
May
(9) |
Jun
(4) |
Jul
(3) |
Aug
(4) |
Sep
(39) |
Oct
(8) |
Nov
(5) |
Dec
(8) |
| 2017 |
Jan
(4) |
Feb
(14) |
Mar
(4) |
Apr
(16) |
May
(5) |
Jun
(10) |
Jul
(25) |
Aug
(2) |
Sep
(5) |
Oct
(11) |
Nov
(8) |
Dec
(11) |
| 2018 |
Jan
(7) |
Feb
(4) |
Mar
|
Apr
(1) |
May
(4) |
Jun
(21) |
Jul
(8) |
Aug
(3) |
Sep
(2) |
Oct
(2) |
Nov
(1) |
Dec
|
| 2019 |
Jan
(1) |
Feb
(5) |
Mar
(18) |
Apr
(9) |
May
(5) |
Jun
(21) |
Jul
(25) |
Aug
(25) |
Sep
(4) |
Oct
(2) |
Nov
(2) |
Dec
(5) |
| 2020 |
Jan
|
Feb
|
Mar
(3) |
Apr
|
May
(2) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
(1) |
Oct
(2) |
Nov
(6) |
Dec
|
| 2021 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
(1) |
May
(4) |
Jun
|
Jul
(1) |
Aug
|
Sep
(2) |
Oct
(9) |
Nov
(1) |
Dec
(5) |
| 2022 |
Jan
(7) |
Feb
(3) |
Mar
|
Apr
(2) |
May
(5) |
Jun
(3) |
Jul
(3) |
Aug
(3) |
Sep
(3) |
Oct
(14) |
Nov
|
Dec
(1) |
| 2023 |
Jan
(10) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
(2) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
(5) |
Nov
|
Dec
|
| 2024 |
Jan
(8) |
Feb
|
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
(4) |
Aug
(5) |
Sep
|
Oct
(4) |
Nov
(1) |
Dec
(1) |
| 2025 |
Jan
(3) |
Feb
(2) |
Mar
(2) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2026 |
Jan
(1) |
Feb
(12) |
Mar
|
Apr
(2) |
May
(8) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: SourceForge.net <no...@so...> - 2010-09-13 09:29:22
|
Patches item #3064571, was opened at 2010-09-12 03:38 Message generated for change (Settings changed) made by lballabio You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312740&aid=3064571&group_id=12740 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed Resolution: Rejected Priority: 5 Private: No Submitted By: manas (manasb) Assigned to: Luigi Ballabio (lballabio) Summary: unitofmeasureconversionmanager.hpp change Initial Comment: removed friend reference to the class from which it is derived ie class UnitOfMeasureConversionManager : public Singleton<UnitOfMeasureConversionManager> { friend class Singleton<UnitOfMeasureConversionManager>; to class UnitOfMeasureConversionManager : public Singleton<UnitOfMeasureConversionManager> { ---------------------------------------------------------------------- Comment By: Luigi Ballabio (lballabio) Date: 2010-09-13 11:29 Message: No, the friend declaration is correct. The error was having the UnitOfMeasureConversionManager constructor public; it should be private (to prevent client code to instantiate it; only the Singleton machinery should) at which point the base Singleton class must be a friend. Thanks for the heads-up anyway; the issue will be fixed in next release. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312740&aid=3064571&group_id=12740 |
|
From: SourceForge.net <no...@so...> - 2010-09-13 09:29:12
|
Patches item #3064571, was opened at 2010-09-12 03:38 Message generated for change (Comment added) made by lballabio You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312740&aid=3064571&group_id=12740 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open >Resolution: Rejected Priority: 5 Private: No Submitted By: manas (manasb) >Assigned to: Luigi Ballabio (lballabio) Summary: unitofmeasureconversionmanager.hpp change Initial Comment: removed friend reference to the class from which it is derived ie class UnitOfMeasureConversionManager : public Singleton<UnitOfMeasureConversionManager> { friend class Singleton<UnitOfMeasureConversionManager>; to class UnitOfMeasureConversionManager : public Singleton<UnitOfMeasureConversionManager> { ---------------------------------------------------------------------- >Comment By: Luigi Ballabio (lballabio) Date: 2010-09-13 11:29 Message: No, the friend declaration is correct. The error was having the UnitOfMeasureConversionManager constructor public; it should be private (to prevent client code to instantiate it; only the Singleton machinery should) at which point the base Singleton class must be a friend. Thanks for the heads-up anyway; the issue will be fixed in next release. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312740&aid=3064571&group_id=12740 |
|
From: SourceForge.net <no...@so...> - 2010-09-12 01:38:02
|
Patches item #3064571, was opened at 2010-09-12 09:38 Message generated for change (Tracker Item Submitted) made by manasb You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312740&aid=3064571&group_id=12740 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: manas (manasb) Assigned to: Nobody/Anonymous (nobody) Summary: unitofmeasureconversionmanager.hpp change Initial Comment: removed friend reference to the class from which it is derived ie class UnitOfMeasureConversionManager : public Singleton<UnitOfMeasureConversionManager> { friend class Singleton<UnitOfMeasureConversionManager>; to class UnitOfMeasureConversionManager : public Singleton<UnitOfMeasureConversionManager> { ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312740&aid=3064571&group_id=12740 |
|
From: manas b. <ma...@ho...> - 2010-09-11 17:42:20
|
Hi Luigi, thanks for the suggestion. I will work on that. Also, i would like to improve the way the code is written especially how the commodity curve and it's associated classes (cashflows, unitofmeasure, etc) are defined. Hope, that's ok with you.regards,Manas > Subject: Re: [Quantlib-dev] Contribute to Quantlib - Commodities > From: lui...@gm... > To: ma...@ho... > CC: qua...@li... > Date: Fri, 10 Sep 2010 17:05:08 +0200 > > On Thu, 2010-09-02 at 22:56 +0800, manas bhatt wrote: > > I would like to contribute to quantlib. My experience is in > > commodities. I have already checked out the source code and have built > > the quantlib library. I saw that commodity is inside experimental > > folder. I would like to know how to move the Commodity module from > > experimental folder to the main quantlib library. > > > Hi Manas, > apologies for the delay. To begin with, it would be of great help if > you might look at the code in the experimental/commodity folder and > check that it does work as advertised. Writing a few test cases would > be great, too. > > Later, > Luigi > > > -- > > Quote me as saying I was misquoted. > -- Groucho Marx > > |
|
From: SourceForge.net <no...@so...> - 2010-09-11 17:28:44
|
Patches item #3064373, was opened at 2010-09-12 01:28 Message generated for change (Tracker Item Submitted) made by manasb You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312740&aid=3064373&group_id=12740 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: manas (manasb) Assigned to: Nobody/Anonymous (nobody) Summary: unitofmeasureconversionmanager.hpp change Initial Comment: removed friend reference to the class from which it is derived ie class UnitOfMeasureConversionManager : public Singleton<UnitOfMeasureConversionManager> { friend class Singleton<UnitOfMeasureConversionManager>; to class UnitOfMeasureConversionManager : public Singleton<UnitOfMeasureConversionManager> { ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312740&aid=3064373&group_id=12740 |
|
From: Kakhkhor A. <kab...@gm...> - 2010-09-10 15:25:49
|
Thanks a lot. That is encouraging. What if the instance() method is synchronized with mutex, could it solve static singleton problem? |
|
From: Luigi B. <lui...@gm...> - 2010-09-10 15:12:16
|
On Thu, 2010-09-02 at 02:49 -0500, Kakhkhor Abdijalilov wrote: > I could run several examples but the test suite crashes instantly with > memory access violation error. Can someone try the test suite with the > singleton attached below? Tried it on an Ubuntu system with gcc 4.4.3. Worked fine... Luigi -- The shortest way to do many things is to do only one thing at once. -- Samuel Smiles |
|
From: Luigi B. <lui...@gm...> - 2010-09-10 15:10:45
|
On Thu, 2010-09-02 at 17:39 +0530, animesh saxena wrote:
> Thanks a lot. Just one minor thing I noticed in
> blackscholesprocess.hpp
>
> dS(t, S) = (r(t) - q(t) - \frac{\sigma(t, S)^2}{2}) dt
> + \sigma dW_t.
>
> The above process is not possible, coz you can't have sigma(t,S).
Except you do. If sigma is not constant, you might not derive all the
usual equations. But you can define the process above just the same.
Luigi
--
Any software problem can be solved by adding another layer of
indirection.
-- David J. Wheeler
|
|
From: Luigi B. <lui...@gm...> - 2010-09-10 15:06:11
|
On Thu, 2010-09-02 at 22:56 +0800, manas bhatt wrote: > I would like to contribute to quantlib. My experience is in > commodities. I have already checked out the source code and have built > the quantlib library. I saw that commodity is inside experimental > folder. I would like to know how to move the Commodity module from > experimental folder to the main quantlib library. Hi Manas, apologies for the delay. To begin with, it would be of great help if you might look at the code in the experimental/commodity folder and check that it does work as advertised. Writing a few test cases would be great, too. Later, Luigi -- Quote me as saying I was misquoted. -- Groucho Marx |
|
From: Kakhkhor A. <kab...@gm...> - 2010-09-09 12:00:38
|
My message didn't show up in Nabble forum. I am resending it just in case it didn't go through. On Wed, Sep 8, 2010 at 8:42 AM, Kakhkhor Abdijalilov <kab...@gm...> wrote: > It seems that LongstaffSchwartzPathPricer implementation may not deal > with basis collinearity properly. > > SVD can deal with collinearity, but the cutoff threshold for small > singular values in LinearLeastSquaresRegression is n*QL_EPSILON (n is > matrix size). > > Btw, the cutoff should be applied to the ratio of singular values, not > to the singular values directly. That is something we need to fix as > well. > > The above cutoff threshold is OK for OLS purposes, but not for MC > (at least how it is implemented in QL). For OLS purposes we compute > coefficients by performing SVD of the design matrix and then use those > coefficients with the same design matrix to compute the projection of > the dependent variable. This way all singular values cancel out as > long as the cutoff was applied. > > But LongstaffSchwartzPathPricer does compute projection (option > continuation values) from a new sample. It is like using the old > coefficients with a new design matrix. There is chance that singular > values of this new design matrix won't cancels out inverse singular > values of the old design matrix. Both design matrices have the same > statistical properties, so that singular values should be more or less > comparable, except very small ones. With typical sample sizes, SVD > cutoff threshold can be as small as 1.0E-012, which is much smaller > than statistical uncertainty of MC (inverse square root of sample > size). Small singular values will show up whenever there is a > collinearity in the basis system. > > Fortunately, the problem is fixed if SVD cutoff (n*QL_EPSILON) is > replaced with something commensurable with MC tolerance. I want to > code and submit new LongstaffSchwartzPathPricer and > LinearLeastSquaresRegression classes, but would like to know others > think. > > With best regards, > Kakhkhor Abdijalilov. |
|
From: Kakhkhor A. <kab...@gm...> - 2010-09-08 13:42:12
|
It seems that LongstaffSchwartzPathPricer implementation may not deal with basis collinearity properly. SVD can deal with collinearity, but the cutoff threshold for small singular values in LinearLeastSquaresRegression is n*QL_EPSILON (n is matrix size). Btw, the cutoff should be applied to the ratio of singular values, not to the singular values directly. That is something we need to fix as well. The above cutoff threshold is OK for OLS purposes, but not for MC (at least how it is implemented in QL). For OLS purposes we compute coefficients by performing SVD of the design matrix and then use those coefficients with the same design matrix to compute the projection of the dependent variable. This way all singular values cancel out as long as the cutoff was applied. But LongstaffSchwartzPathPricer does compute projection (option continuation values) from a new sample. It is like using the old coefficients with a new design matrix. There is chance that singular values of this new design matrix won't cancels out inverse singular values of the old design matrix. Both design matrices have the same statistical properties, so that singular values should be more or less comparable, except very small ones. With typical sample sizes, SVD cutoff threshold can be as small as 1.0E-012, which is much smaller than statistical uncertainty of MC (inverse square root of sample size). Small singular values will show up whenever there is a collinearity in the basis system. Fortunately, the problem is fixed if SVD cutoff (n*QL_EPSILON) is replaced with something commensurable with MC tolerance. I want to code and submit new LongstaffSchwartzPathPricer and LinearLeastSquaresRegression classes, but would like to know others think. With best regards, Kakhkhor Abdijalilov. |
|
From: Luigi B. <lui...@gm...> - 2010-09-08 13:40:19
|
On Mon, 2010-08-23 at 13:00 -0400, Robert Philipp wrote: > The PiecewiseZeroSpreadedTermStructure class does not shock correctly > when the compounding is different from continuous. Yes, the curve assumed that the spread was applied to the continuous rates. Thanks for the generalization; it will make it into next release. > I believe that the way forward rates are shocked is incorrect. In the > code, the spread (shock) is simply added to the forward curve of the > base. The forward curve should be based on the shocked zero curve > instead. Has anyone fixed that? If not, I'll try to fix that as well. You're talking of the ForwardSpreadedTermStructure class now, right? I'm not sure what the behavior should be in this case. The name of the class seems to imply that we want to add a spread to the forwards, though. > Not sure how best to contribute the code. Is there a staging area for > checking in the code? Posting here is ok. Next time, you might consider providing a patch instead of the modified file (i.e., the output of running the diff program between the original file and your file.) But it's no big deal. Just one question on your code: you added a declaration for Rate forwardImpl(Time) const; to the header, but no definition afterwards. Is there a method body you didn't post, or should I just remove the declaration? Thanks, Luigi P.S. Make that two questions: to whom should I assign the copyright of the modified code? (Robert Philipp, Synapsefe, both?) -- Green's Law of Debate: Anything is possible if you don't know what you're talking about. |
|
From: manas b. <ma...@ho...> - 2010-09-02 14:56:41
|
Hi, I would like to contribute to quantlib. My experience is in commodities. I have already checked out the source code and have built the quantlib library. I saw that commodity is inside experimental folder. I would like to know how to move the Commodity module from experimental folder to the main quantlib library.thanksManas |
|
From: animesh s. <ani...@gm...> - 2010-09-02 12:10:08
|
Thanks a lot. Just one minor thing I noticed in blackscholesprocess.hpp
dS(t, S) = (r(t) - q(t) - \frac{\sigma(t, S)^2}{2}) dt
+ \sigma dW_t.
The above process is not possible, coz you can't have sigma(t,S). The
above equation is derived only because sigma is constant. It's a bit
misleading, Can I make the change to the correct version
dS(t, S) = (r(t) - q(t) - \frac{\sigma^2}{2}) dt
+ \sigma dW_t
It's a one line change, In the last few lines of my blog I have given
the proof.
http://quantanalysis.wordpress.com/2010/08/21/
Just read the ending portion. /
/
On 9/2/10 4:37 PM, Kakhkhor Abdijalilov wrote:
> Forwarding...
>
>> Thanks for your inputs.
>> I observed a pattern in some exotic options. Correct me if I am wrong.
>> Similar to himalayan option, in variance swap engine also we have the
>> following code
>> MCVarianceSwapEngine(
>> const boost::shared_ptr<GeneralizedBlackScholesProcess>& process
>>
>> Since most of the engines are specifically using
>> GeneralizedBlackScholesProcess it's impossible to value the option using any
>> other process. Practically a person would like to value the instrument using
>> any possible process. After struggling with Merton76Process for valuing
>> Himalayan option I tried to get my head around with HestonProcess. It wasn't
>> even remotely possible. Yes I could do the same in excel, but again excel
>> can't do 9Million simulations which Quantlib can do in seconds :). That's
>> why I am trying to replace my excel side of modeling with C++ QuantLib!
>>
>> So what I want to try is "make the above dependency more generic". It should
>> be possible in some way. Any inputs from you guys will help a lot.
>>
>> Thanks again,
>> Animesh Saxena
>>
>> (http://quantanalysis.wordpress.com)
>> Ph: (+91)9920098221
> ------------------------------------------------------------------------------
> This SF.net Dev2Dev email is sponsored by:
>
> Show off your parallel programming skills.
> Enter the Intel(R) Threading Challenge 2010.
> http://p.sf.net/sfu/intel-thread-sfd
> _______________________________________________
> QuantLib-dev mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev
>
--
Regards,
Animesh Saxena
(http://quantanalysis.wordpress.com)
Ph: (+91)9920098221
|
|
From: Kakhkhor A. <kab...@gm...> - 2010-09-02 11:07:27
|
Forwarding... > Thanks for your inputs. > I observed a pattern in some exotic options. Correct me if I am wrong. > Similar to himalayan option, in variance swap engine also we have the > following code > MCVarianceSwapEngine( > const boost::shared_ptr<GeneralizedBlackScholesProcess>& process > > Since most of the engines are specifically using > GeneralizedBlackScholesProcess it's impossible to value the option using any > other process. Practically a person would like to value the instrument using > any possible process. After struggling with Merton76Process for valuing > Himalayan option I tried to get my head around with HestonProcess. It wasn't > even remotely possible. Yes I could do the same in excel, but again excel > can't do 9Million simulations which Quantlib can do in seconds :). That's > why I am trying to replace my excel side of modeling with C++ QuantLib! > > So what I want to try is "make the above dependency more generic". It should > be possible in some way. Any inputs from you guys will help a lot. > > Thanks again, > Animesh Saxena > > (http://quantanalysis.wordpress.com) > Ph: (+91)9920098221 |
|
From: animesh s. <ani...@gm...> - 2010-09-02 10:20:58
|
Thanks for your inputs.
I observed a pattern in some exotic options. Correct me if I am wrong.
Similar to himalayan option, in variance swap engine also we have the
following code
MCVarianceSwapEngine(
const boost::shared_ptr<GeneralizedBlackScholesProcess>&
process
Since most of the engines are specifically using
GeneralizedBlackScholesProcess it's impossible to value the option using
any other process. Practically a person would like to value the
instrument using any possible process. After struggling with
Merton76Process for valuing Himalayan option I tried to get my head
around with HestonProcess. It wasn't even remotely possible. Yes I could
do the same in excel, but again excel can't do 9Million simulations
which Quantlib can do in seconds :). That's why I am trying to replace
my excel side of modeling with C++ QuantLib!
So what I want to try is "make the above dependency more generic". It
should be possible in some way. Any inputs from you guys will help a lot.
Thanks again,
Animesh Saxena
(http://quantanalysis.wordpress.com)
Ph: (+91)9920098221
On 9/1/10 5:09 PM, Kakhkhor Abdijalilov wrote:
> static_pointer_cast on smart pointer will perform static_cast on the
> contained pointer. static_cast will never fail at compiler time
> (unless you try to cast away qualifiers such as const or volatile).
> But if the conversion is illegal, the code will fail at runtime.
> dynamic_cast will check at compile time if the pointer is being
> downcast. If target is not inherited from the source, dynamic_cast
> will refuse to compile.
>
> static_cast cast is faster then dynamic_cast, but inherently unsafe.
> In the above example it is used not in performance critical place.
>
> Hope it help.
>
> ------------------------------------------------------------------------------
> This SF.net Dev2Dev email is sponsored by:
>
> Show off your parallel programming skills.
> Enter the Intel(R) Threading Challenge 2010.
> http://p.sf.net/sfu/intel-thread-sfd
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|
|
From: Kakhkhor A. <kab...@gm...> - 2010-09-02 07:50:02
|
I could run several examples but the test suite crashes instantly with
memory access violation error. Can someone try the test suite with the
singleton attached below?
////////////////////////////////////////////////////////////////////
#ifndef quantlib_singleton_hpp
#define quantlib_singleton_hpp
#include <ql/types.hpp>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <map>
namespace QuantLib {
#if defined(QL_ENABLE_SESSIONS)
Integer sessionId();
#endif
template <class T>
class Singleton : private boost::noncopyable {
public:
static T& instance() {
#if defined(QL_ENABLE_SESSIONS)
Integer id = sessionId();
#else
Integer id = 0;
#endif
boost::shared_ptr<T>& p = instances_[id];
if (!p)
p.reset(new T);
return *p;
}
protected:
Singleton() {}
private:
typedef std::map<Integer, boost::shared_ptr<T> > map_type;
static map_type instances_;
};
template <typename T>
typename Singleton<T>::map_type Singleton<T>::instances_;
}
#endif
|
|
From: Kakhkhor A. <kab...@gm...> - 2010-09-02 06:24:20
|
private: static map_type instances_; It works. No need to for scoped_ptr. I tested it with Intel compiler. |
|
From: Luigi B. <lui...@gm...> - 2010-09-01 14:20:22
|
On Wed, 2010-09-01 at 05:24 -0500, Kakhkhor Abdijalilov wrote: > I think it is broken just like the design using scoped_ptr or the > original design. Ok. One way or the other, Singletons are all broken. But trying to avoid breaking interfaces for the time being, and in "normal" usage (i.e., no Singletons initialized before main() starts): was it needed to put the map into a scoped_ptr, as in: private: static const boost::scoped_ptr<map_type> instances_; or would the following work, too? private: static map_type instances_; Luigi -- Though this be madness, yet there is method in't. -- Hamlet, Act II, scene II |
|
From: SourceForge.net <no...@so...> - 2010-09-01 14:07:48
|
Patches item #3047358, was opened at 2010-08-18 01:25 Message generated for change (Comment added) made by lballabio You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312740&aid=3047358&group_id=12740 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: renorm (renorm) Assigned to: Nobody/Anonymous (nobody) Summary: fixed gaussian orthogonal polynomial Initial Comment: double with zero comparison issue Only fixed function are included ---------------------------------------------------------------------- >Comment By: Luigi Ballabio (lballabio) Date: 2010-09-01 16:07 Message: With your patch, two cases in the test suite fail. May you investigate? ---------------------------------------------------------------------- Comment By: renorm (renorm) Date: 2010-08-18 15:08 Message: the whole file with fixes ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312740&aid=3047358&group_id=12740 |
|
From: Kakhkhor A. <kab...@gm...> - 2010-09-01 10:24:10
|
I think it is broken just like the design using scoped_ptr or the
original design. Consider what happens when Singleton's instance is
used in two implementation files.
// file1.cpp
namespace {
SingletonObject* const ptr = &SingletonObject::instance();
}
// file2.cpp
namespace {
SingletonObject* const ptr = &SingletonObject::instance();
}
Who get's to build the singleton?
The only way to avoid this problem is to make the instance itself a
static local and forget about session ID. Each session would have to
reset the singleton, if needed.
A half-solution is to make sure that no instance is crated before
main() is launched. That means no static objects using singleton.
Which way we go?
|
|
From: Luigi B. <lui...@gm...> - 2010-09-01 08:35:11
|
On Sat, 2010-08-14 at 20:14 -0500, Kakhkhor Abdijalilov wrote:
> Somehow static non-const local variables and templates don't mix on
> ICC. I modified the original implementation to uses const static
> variable and everything worked well. The new implementation is
> attached.
Kakhkhor,
do you also need the scoped_ptr below? Would a simple static const
map_type work?
Luigi
> //-----------------------------------------
> template <class T>
> class Singleton : private boost::noncopyable {
> ...
> private:
> typedef std::map<Integer, boost::shared_ptr<T> > map_type;
> static const boost::scoped_ptr<map_type> instances_;
> };
>
> template <typename T>
> const boost::scoped_ptr<Singleton<T>::map_type>
> Singleton<T>::instances_(new Singleton<T>::map_type);
--
The First Rule of Optimization: Don't do it.
The Second Rule of Optimization (For experts only): Don't do it yet.
-- Michael Jackson
|
|
From: Luigi B. <lui...@gm...> - 2010-09-01 08:24:35
|
On Wed, 2010-09-01 at 09:06 +0200, Luigi Ballabio wrote: > On Wed, 2010-09-01 at 01:44 +0530, animesh saxena wrote: > > Also another thing I will point out. Maybe you can understand this > > better. > > There is no evolve() method in merton76process.hpp. > > It inherits the generic implementation in StochasticProcess1D. However, it lacks the methods such as drift() etc which are required by evolve(). You're right, it's currently not usable as a process; it's just a container for the curves and the other data. Luigi -- The first thing we do, let's kill all the lawyers. -- W. Shakespeare, "King Henry VI, Part II" |
|
From: Luigi B. <lui...@gm...> - 2010-09-01 07:06:51
|
On Wed, 2010-09-01 at 01:44 +0530, animesh saxena wrote: > Also another thing I will point out. Maybe you can understand this > better. > There is no evolve() method in merton76process.hpp. It inherits the generic implementation in StochasticProcess1D. Luigi -- Vin: It's like this fellow I knew in El Paso. One day, he just took all his clothes off and jumped in a mess of cactus. I asked him that same question, "Why?" Calvera: And? Vin: He said, "It seemed like a good idea at the time." -- The Magnificent Seven |
|
From: animesh s. <ani...@gm...> - 2010-08-31 20:14:54
|
Also another thing I will point out. Maybe you can understand this better. There is no evolve() method in *merton76process.hpp. **So I think even when casting works perfectly as per the below mentioned changes, it can't price as it's trying to build up the path. Not sure why evolve method is not there. Without evolve the merton76process should not work at all for other things too. Am I missing something here?* * * On 9/1/10 1:10 AM, animesh saxena wrote: > You are right, It compiled once and now it just gave out BAD_ACCESS > error. > Here's what I am trying to do just to get the simulation work. I added > the mchimalayanengine.hpp file to my project and changed it, and in my > main code I change the header file path to #include > "mchimalayanengine.hpp" (My new file). > > In this I just changed....the class > > boost::shared_ptr<Merton76Process> process = > boost::dynamic_pointer_cast<Merton76Process>(processes_->process(0)); > // QL_REQUIRE(process, "Black-Scholes process required"); > > return boost::shared_ptr<typename > MCHimalayaEngine<RNG,S>::path_pricer_type>(new > HimalayaMultiPathPricer(arguments_.payoff,process->riskFreeRate()->discount(arguments_.exercise->lastDate()))); > > Now if I debug the code executes till after this line even with a > dynamic cast. I checked that merton76Process has a riskFreeRate > method. Now after all this it gives out a SIGABRT error. Still trying > to understand why it is so! > > > On 8/31/10 7:26 PM, Luigi Ballabio wrote: >> On Tue, 2010-08-31 at 17:47 +0530, animesh saxena wrote: >>> I located the error in the code. I think this is probably due to >>> design. >>> Generally people would like to price options using different >>> processes. For example Himalayan Option is priced using BlackScholes >>> process in the example. When I change it to another process like >>> Merton76Process (which also is Stochastic1D - as per the guidelines), >>> I should be able to price it. >> Yes, in principle. But while the path generation does work with a >> generic process, the McHimalaya path pricer calls a method from the >> BlackScholes interface, namely, riskFreeRate(). The method is not in >> the Stochastic1D interface, so we need to cast. >> >>> The cast is throwing the error. >> It should. >> >>> If I change it to "STATIC CAST", the error is gone! >>> boost::shared_ptr<GeneralizedBlackScholesProcess> process = >>> >>> boost::static_pointer_cast<GeneralizedBlackScholesProcess>( >>> >>> processes_->process(0)); >> Honestly, I have no idea why this works. The process you're passing is >> not a GeneralizedBlackScholesProcess, so the cast you're forcing should >> not succeed. It might just so happen that the bits align right, but >> that's not guaranteed to be portable. >> >> As for a better solution, I'm not sure I have it. It could be that >> instead of an array of Black-Scholes processes, the Himalaya engine >> takes a generic process and a discount curve (so it doesn't have to >> retrieve the risk-free curve.) >> >> Luigi >> >> > -- Regards, Animesh Saxena (http://quantanalysis.wordpress.com) Ph: (+91)9920098221 |