tackle Vanilla Swaps. This is maybe the first "full-blown" example, so
Comments are welcome.
> unlikely (the optimization level)
> Peter
>
>
> On 14 January 2015 at 02:49, cheng li <
[hidden email]> wrote:
>> Hi Peter,
>>
>> I'll definitely have a try. Thank you :)
>>
>> Actually yesterday I tried on another machine with g++ 4.8.2 and O2 setting, then everything works fine. I think my previous problem may be due to O3.
>>
>> Regards,
>> Cheng
>>
>> -----邮件原件-----
>> 发件人: Peter Caspers [mailto:
[hidden email]]
>> 发送时间: 2015年1月13日 21:18
>> 收件人: cheng li
>> 抄送: Luigi Ballabio; QuantLib developers
>> 主题: Re: 答复: [Quantlib-dev] 答复: Adjoint Greeks
>>
>> I will clean up the adjoint branch to make it c++03 compliant. Unless QuantLib 2.0 is out before the adjoint conversion has finished :-)
>>
>> On 13 January 2015 at 02:28, cheng li <
[hidden email]> wrote:
>>> Hi Luigi,
>>>
>>>
>>>
>>> I think I can not to avoid to use c++ 11 now.. In Peter’s branch much
>>> c++ 11 stuff is used, e.g. constexpr…
>>>
>>>
>>>
>>> Regards,
>>>
>>> Cheng
>>>
>>>
>>>
>>> 发件人: Luigi Ballabio [mailto:
[hidden email]]
>>> 发送时间: 2015年1月12日 14:28
>>> 收件人: Cheng Li
>>> 抄送: QuantLib developers; Peter Caspers
>>> 主题: Re: [Quantlib-dev] 答复: Adjoint Greeks
>>>
>>>
>>>
>>> Don't use C++11.
>>>
>>> Luigi
>>>
>>> On Jan 12, 2015 4:53 AM, "cheng li" <
[hidden email]> wrote:
>>>
>>> Hi peter,
>>>
>>> I have switched to adjoint brank. However I am still facing some problem...
>>> I use g++ 4.9.2 with parameter "-std=c++11 -O3"
>>>
>>> /bin/bash ../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I.
>>> -I../../ql -I../.. -I../.. -std=c++11 -O3 -MT averagebmacoupon.lo -MD -MP
>>> -MF .deps/averagebmacoupon.Tpo -c -o averagebmacoupon.lo
>>> averagebmacoupon.cpp
>>> libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../ql -I../.. -I../..
>>> -std=c++11 -O3 -MT averagebmacoupon.lo -MD -MP -MF
>>> .deps/averagebmacoupon.Tpo -c averagebmacoupon.cpp -fPIC -DPIC -o
>>> .libs/averagebmacoupon.o In file included from
>>> ../../ql/patterns/observable.hpp:29:0,
>>> from ../../ql/event.hpp:29,
>>> from ../../ql/cashflow.hpp:28,
>>> from ../../ql/cashflows/coupon.hpp:29,
>>> from ../../ql/cashflows/floatingratecoupon.hpp:33,
>>> from ../../ql/cashflows/averagebmacoupon.hpp:28,
>>> from averagebmacoupon.cpp:21:
>>> ../../ql/patterns/observable.hpp: In member function 'void
>>> QuantLib::Observable::notifyObservers()':
>>> ../../ql/errors.hpp:121:70: error: use of deleted function
>>> 'QuantLib::Error::Error(const QuantLib::Error&)'
>>> BOOST_CURRENT_FUNCTION,_ql_msg_stream.str()); \
>>>
>>> ^
>>> ../../ql/patterns/observable.hpp:139:9: note: in expansion of macro
>>> 'QL_ENSURE'
>>> QL_ENSURE(successful,
>>> ^
>>> ../../ql/errors.hpp:39:11: note: 'QuantLib::Error::Error(const
>>> QuantLib::Error&)' is implicitly deleted because the default
>>> definition would be ill-formed:
>>> class Error : public std::exception {
>>> ^
>>> ../../ql/errors.hpp:39:11: error: use of deleted function
>>> 'boost::shared_ptr<std::basic_string<char> >::shared_ptr(const
>>> boost::shared_ptr<std::basic_string<char> >&)'
>>> In file included from /usr/include/boost/shared_ptr.hpp:17:0,
>>> from ../../ql/errors.hpp:31,
>>> from ../../ql/patterns/observable.hpp:29,
>>> from ../../ql/event.hpp:29,
>>> from ../../ql/cashflow.hpp:28,
>>> from ../../ql/cashflows/coupon.hpp:29,
>>> from ../../ql/cashflows/floatingratecoupon.hpp:33,
>>> from ../../ql/cashflows/averagebmacoupon.hpp:28,
>>> from averagebmacoupon.cpp:21:
>>> /usr/include/boost/smart_ptr/shared_ptr.hpp:168:25: note:
>>> 'boost::shared_ptr<std::basic_string<char> >::shared_ptr(const
>>> boost::shared_ptr<std::basic_string<char> >&)' is implicitly declared
>>> as deleted because 'boost::shared_ptr<std::basic_string<char> >'
>>> declares a move constructor or move assignment operator
>>>
>>> Any idea about this?
>>>
>>> Regards,
>>> Cheng
>>>
>>> -----邮件原件-----
>>> 发件人: Peter Caspers [mailto:
[hidden email]]
>>> 发送时间: 2015年1月11日 17:34
>>> 收件人: Cheng Li
>>> 抄送: QuantLib Mailing Lists
>>> 主题: Re: 答复: [Quantlib-dev] Adjoint Greeks
>>>
>>> Hi Cheng,
>>>
>>> you are welcome and many thanks for your interest. However you seem to
>>> work on my master branch which I consider as my private workspace
>>> (with some unfinished things in it). Sorry, I wasn't expecting guests
>>> here :-)
>>>
>>> You probably want to try out the adjoint branch instead. This should
>>> compile.
>>>
>>> Thanks
>>> Peter
>>>
>>> On 11 January 2015 at 10:16, Cheng Li <
[hidden email]> wrote:
>>>> Hi Peter,
>>>>
>>>> Thank you for your kindly offer these new stuff for all of us!
>>>>
>>>> I have cloned your branch and tried to build it on my machine. When
>>>> it was building the example/InterestRateSmile, the compiler
>>>> complained as
>>>> following:
>>>>
>>>> InterestRateSmiles.cpp: In function ‘void zabrExamples()’:
>>>> InterestRateSmiles.cpp:64:39: error: type/value mismatch at argument
>>>> 1 in template parameter list for ‘template<class T> class boost::shared_ptr’
>>>> boost::shared_ptr<ZabrSmileSection> zabrln =
>>>> ^
>>>> InterestRateSmiles.cpp:64:39: error: expected a type, got
>>>> ‘ZabrSmileSection’
>>>> InterestRateSmiles.cpp:64:48: error: invalid type in declaration
>>>> before ‘=’ token
>>>> boost::shared_ptr<ZabrSmileSection> zabrln =
>>>> ^
>>>> InterestRateSmiles.cpp:67:13: error: ‘template<class Evaluation>
>>>> class QuantLib::ZabrSmileSection’ used without template parameters
>>>> ZabrSmileSection::ShortMaturityLognormal);
>>>>
>>>> I am not sure what is the problem... Is it due to missing template
>>>> argument for ZabrSmileSection?
>>>> My compiler is g++ 4.8.2 and with parameter "-std=c++11 -O3"
>>>>
>>>> BTW, I found that quadraticlfm.hpp and quadraticlfm.cpp are missing
>>>> from the branch. However when I adjust the makefile.am to exclude
>>>> them out the compiling process works fine.
>>>>
>>>>
>>>> Regards,
>>>> Cheng
>>>>
>>>> -----邮件原件-----
>>>> 发件人: Peter Caspers [mailto:
[hidden email]]
>>>> 发送时间: 2015年1月9日 3:57
>>>> 收件人: Luigi Ballabio
>>>> 抄送: QuantLib Mailing Lists; Ferdinando M. Ametrano
>>>> 主题: Re: [Quantlib-dev] Adjoint Greeks
>>>>
>>>> I thought in a realistic application you would always need both
>>>> worlds, CppAD<double> for adjoint greek engines and double for all
>>>> the rest. I wonder what it would mean in terms of performance and
>>>> memory if you replace double by CppAD<double> in general. I can maybe
>>>> just stress test this a bit though.
>>>> Peter
>>>>
>>>>
>>>>
>>>> On 7 January 2015 at 10:23, Luigi Ballabio <
[hidden email]>
>>>> wrote:
>>>>> Switching Real would force you to fix compilation problems all over
>>>>> the library, instead of just in the code you're converting.
>>>>>
>>>>> If you wanted to go the route of #defining the type, I guess you
>>>>> could introduce another type (ADReal or something) and switch the
>>>>> coverted code to use it.
>>>>> Which might or might not be a good idea; you wouldn't be forced to
>>>>> templatize the code, but you would have to choose AD or not at
>>>>> compilation time, instead that having the choice to use both for
>>>>> different
>>>> tasks. Hmm...
>>>>>
>>>>> Anyway: yes, very promising. Between Peter, Klaus and Joseph, we got
>>>>> a lot of presents this Christmas :)
>>>>>
>>>>> Luigi
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Jan 7, 2015 at 9:41 AM, Ferdinando M. Ametrano
>>>>> <
[hidden email]> wrote:
>>>>>>
>>>>>> Thank you Peter, it sounds exciting and promising.
>>>>>> Why haven't you considered to just change the Real typedef from
>>>>>> double to CppAD::AD<double>?
>>>>>>
>>>>>> On Sun, Jan 4, 2015 at 9:55 PM, Peter Caspers
>>>>>> <
[hidden email]>
>>>>>> wrote:
>>>>>>>
>>>>>>> Hello all,
>>>>>>>
>>>>>>> happy new year.
>>>>>>>
>>>>>>> I revisited Ferdinando's comments on adjoint greeks during our
>>>>>>> December workshop and started to play around with that idea.
>>>>>>>
>>>>>>> The approach I am trying to follow is to adapt the ql library code
>>>>>>> so that automatic differentiation _tools_ can be used with it in a
>>>>>>> transparent way. This is opposed to writing special adjoint
>>>>>>> engines by _hand_ like e.g. advocated in Capriotti, Giles,
>>>>>>> Algorithmic
>>>>>>> Differentiation: Adjoint Greeks Made Easy. The relatively small
>>>>>>> and homogeneous code basis of ql seems to allow for this kind of
>>>>>>> more fundamental approach.
>>>>>>>
>>>>>>> I wrote a bit about my first steps in my blog
>>>>>>>
>>>>>>>
http://quantlib.wordpress.com/>>>>>>>
>>>>>>> and forked a new branch from Luigi's current master on github
>>>>>>>
>>>>>>>
https://github.com/pcaspers/quantlib/tree/adjoint>>>>>>>
>>>>>>> where I started to template'ize the library in order to allow for
>>>>>>> AD tools to hook in. There are already first working examples (see
>>>>>>> the
>>>>>>> blog) and I am starting to feel confident that the approach might
>>>>>>> work as a whole, might be doable in a reasonable amount of time
>>>>>>> and is worthwhile following.
>>>>>>>
>>>>>>> About the feasibility: The library seems to consist of roughly
>>>>>>> 376k lines of code currently (all hpp and cpp files under ql / ).
>>>>>>> From that we can subtract "data" files
>>>>>>>
>>>>>>> 78862 ./math/randomnumbers/sobolrsg.cpp
>>>>>>> 21376 ./math/randomnumbers/primitivepolynomials.cpp
>>>>>>> 14495 ./math/randomnumbers/latticerules.cpp
>>>>>>> 10115 ./experimental/volatility/noarbsabrabsprobs.cpp
>>>>>>>
>>>>>>> which leaves us with 251k lines. It seems that I have already
>>>>>>> reviewed and adapted around 14k lines, which is 5% and which took
>>>>>>> me approximately 60 hours. This gives an estimation of 130 person
>>>>>>> days still left to do. For the whole (!) library where already
>>>>>>> parts will make much sense and give interesting applications. E.g.
>>>>>>> excluding experimental classes (90k) and the market model (25k)
>>>>>>> reduces the estimate already to 65 person days to go.
>>>>>>>
>>>>>>> I would be interested in your opinions on that, in particular
>>>>>>> regarding the design choices to make (better now than later :-) ).
>>>>>>>
>>>>>>> I'd also be grateful for people supporting the development by
>>>>>>> forking the adjoint branch and sending pull requests with adapted
>>>>>>> code
>>>> pieces.
>>>>>>> My personal next steps would be
>>>>>>> - rate deltas for Legs / Swap instruments
>>>>>>> - rate vegas for vanilla interest rate options
>>>>>>> - Hull White model
>>>>>>>
>>>>>>> What do you think ?
>>>>>>>
>>>>>>> Thank you
>>>>>>> Peter
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------
>>>>>>> -
>>>>>>> -
>>>>>>> ---------- Dive into the World of Parallel Programming! The Go
>>>>>>> Parallel Website, sponsored by Intel and developed in partnership
>>>>>>> with Slashdot Media, is your hub for all things parallel software
>>>>>>> development, from weekly thought leadership blogs to news, videos,
>>>>>>> case studies, tutorials and more. Take a look and join the
>>>>>>> conversation now.
http://goparallel.sourceforge.net>>>>>>> _______________________________________________
>>>>>>> QuantLib-dev mailing list
>>>>>>>
[hidden email]
>>>>>>>
https://lists.sourceforge.net/lists/listinfo/quantlib-dev>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> -------------------------------------------------------------------
>>>>>> -
>>>>>> -
>>>>>> --------- Dive into the World of Parallel Programming! The Go
>>>>>> Parallel Website, sponsored by Intel and developed in partnership
>>>>>> with Slashdot Media, is your hub for all things parallel software
>>>>>> development, from weekly thought leadership blogs to news, videos,
>>>>>> case studies, tutorials and more. Take a look and join the
>>>>>> conversation now.
http://goparallel.sourceforge.net>>>>>> _______________________________________________
>>>>>> QuantLib-dev mailing list
>>>>>>
[hidden email]
>>>>>>
https://lists.sourceforge.net/lists/listinfo/quantlib-dev>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> <
https://implementingquantlib.blogspot.com>
>>>>> <
https://twitter.com/lballabio>
>>>>
>>>> ---------------------------------------------------------------------
>>>> -
>>>> ------
>>>> --
>>>> Dive into the World of Parallel Programming! The Go Parallel Website,
>>>> sponsored by Intel and developed in partnership with Slashdot Media,
>>>> is your hub for all things parallel software development, from weekly
>>>> thought leadership blogs to news, videos, case studies, tutorials and
>>>> more. Take a look and join the conversation now.
>>>>
http://goparallel.sourceforge.net>>>> _______________________________________________
>>>> QuantLib-dev mailing list
>>>>
[hidden email]
>>>>
https://lists.sourceforge.net/lists/listinfo/quantlib-dev>>>>
>>>
>>>
>>>
>>> ----------------------------------------------------------------------
>>> -------- New Year. New Location. New Benefits. New Data Center in
>>> Ashburn, VA.
>>> GigeNET is offering a free month of service with a new server in Ashburn.
>>> Choose from 2 high performing configs, both with 100TB of bandwidth.
>>> Higher redundancy.Lower latency.Increased capacity.Completely compliant.
>>> vanity: www.gigenet.com
>>> _______________________________________________
>>> QuantLib-dev mailing list
>>>
[hidden email]
>>>
https://lists.sourceforge.net/lists/listinfo/quantlib-dev>>
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.