From edd at debian.org Wed Oct 8 13:52:22 2014 From: edd at debian.org (Dirk Eddelbuettel) Date: Wed, 8 Oct 2014 06:52:22 -0500 Subject: [Rquantlib-devel] RQuantLib fixed-income discussion (Re: 1 Rquantlib-devel moderator request(s) waiting) In-Reply-To: References: <21541.20322.766800.846918@max.nulle.part> <21541.22633.278467.435646@max.nulle.part> <21541.51246.950057.469654@max.nulle.part> <21548.11418.918918.340419@max.nulle.part> Message-ID: <21557.9590.999103.396097@max.nulle.part> On 8 October 2014 at 10:53, Michele Salvadore wrote: | Hi Dick, Dirk, with an r. It happens :) | Eventually I was able to get it up. Ok. If you have suggestions for making the documentation clearer let me know. | I've been working a bit on the bond interface as I needed to make it more | flexible and match more closely the structure on the QuantLib side. Briefly, I | changed the interface (just for FixedRateBond for the time being) to match the | most general case available on the quantlib side: | 1. provide a named list 'bond' with all parameters matching | the?QuantLib::FixedRateBond ctor (with externally constructed schedule), apart | from the schedule (constructed separately) and the coupon rates vector (also | constructed separately). | 2. provide a named list 'schedule' with all parameters matching the | QuantLib::Schedule ctor. | 3. provide a named list 'calc' with parameters required for some additional | calculations (for example duration) | 4. Either a yield or a discountCurve can be provided (if both are not available | or defined I stop()). Depending on which is given, we include a price engine or | not and calculate parameters accordingly (in case of yield, as there is no | price engine, I return NA for NPV). In both cases, the same type of object is | returned to R, a FixedRateBond. | 5. I added some additional field to the returned object: the settlementDate | used in the calculation (not necessarily obvious from the input parameters) and | the duration. | 6. I extended the supported calendars by using the getCalendar function already | available in calendars.cpp (there was a different getCalendar function declared | in the header which didn't have an implementation and I substituted it with the | correct declaration). | | I was wondering what you think of these changes. I would like to contribute | them back to the package, but I am worried about the fact the the need to | extend the interface has broken backward compatibility for FixedRateBond. I was I generally like backwards compatibility. This may be an exception where it is worth breaking things. | initially thinking of adding a new function with a different name, but I | believe that would be very confusing for users. My believe is that the | FixedRateBond should match as closely as possible the QuantLib::FixedRateBond | (even the name says that :)). | If you think it would be worthile, I would implement similar changes to the | other bond functions in the package and contribute it back. | | Looking forward to hearing your opinion on this, Can you provide a 'pull request' ? That is the GitHub way of clearly showing the differences. If you know (some) git, creating a branch and a pull request is easy. If you don't know git, it may be worth learning. We can also fall back to 'diff and patch'. This discussion should be on the mailing list, though, so I am reverting it there. Please follow-up on list, if possible. Dirk | Michele | | | On 1 October 2014 18:32, Dirk Eddelbuettel wrote: | | | Hi again, | | On 1 October 2014 at 18:18, Michele Salvadore wrote: | | Hi Dirk, | | | | sorry to bother you, I was wondering if you had the chance to take a look | at | | this issue (multiple definitions at linkage). It looks like something to | do | | I have not. | | RQuantLib builds at CRAN incl on the win-builder service. | | | with proper header inclusion, but I'm not sure what's going on. Btw, I | was able | | to get all other issues/warning sorted (including openmp and so on), this | is | | the last bit left before being able to work on it. | | Can you construct a small reproducible example and post it (within the 40kb | limit, ie do not attach or include lots) to the list? | | Dirk | | | Thanks a lot, apologies for bothering! | | | | Michele | | | | On 26 September 2014 22:10, Dirk Eddelbuettel wrote: | | | | | |? ? ?On 26 September 2014 at 20:48, Michele Salvadore wrote: | |? ? ?| Sorry about that dirk, will keep it shorter in the future :) i was | out of | |? ? ?Office today and saw emails just now. | | | |? ? ?No worries. | | | |? ? ?What is a little stranger is that I can see the post now in the list | |? ? ?archives, yet I never seem to have gotten a copy to my account. | | | |? ? ?We'll follow up in a bit. | | | |? ? ?Dirk | | | |? ? ?-- | |? ? ?http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org | | | | | | -- | http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org | | -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From michele.salvadore at gmail.com Wed Oct 8 15:23:18 2014 From: michele.salvadore at gmail.com (Michele Salvadore) Date: Wed, 8 Oct 2014 15:23:18 +0200 Subject: [Rquantlib-devel] RQuantLib fixed-income discussion (Re: 1 Rquantlib-devel moderator request(s) waiting) In-Reply-To: <21557.9590.999103.396097@max.nulle.part> References: <21541.20322.766800.846918@max.nulle.part> <21541.22633.278467.435646@max.nulle.part> <21541.51246.950057.469654@max.nulle.part> <21548.11418.918918.340419@max.nulle.part> <21557.9590.999103.396097@max.nulle.part> Message-ID: On 8 October 2014 13:52, Dirk Eddelbuettel wrote: > > On 8 October 2014 at 10:53, Michele Salvadore wrote: > | Hi Dick, > > Dirk, with an r. It happens :) > So sorry!!! apologies for the pun, was definitely not intended. > > | Eventually I was able to get it up. > > Ok. If you have suggestions for making the documentation clearer let me > know. > > | I've been working a bit on the bond interface as I needed to make it more > | flexible and match more closely the structure on the QuantLib side. > Briefly, I > | changed the interface (just for FixedRateBond for the time being) to > match the > | most general case available on the quantlib side: > | 1. provide a named list 'bond' with all parameters matching > | the QuantLib::FixedRateBond ctor (with externally constructed schedule), > apart > | from the schedule (constructed separately) and the coupon rates vector > (also > | constructed separately). > | 2. provide a named list 'schedule' with all parameters matching the > | QuantLib::Schedule ctor. > | 3. provide a named list 'calc' with parameters required for some > additional > | calculations (for example duration) > | 4. Either a yield or a discountCurve can be provided (if both are not > available > | or defined I stop()). Depending on which is given, we include a price > engine or > | not and calculate parameters accordingly (in case of yield, as there is > no > | price engine, I return NA for NPV). In both cases, the same type of > object is > | returned to R, a FixedRateBond. > | 5. I added some additional field to the returned object: the > settlementDate > | used in the calculation (not necessarily obvious from the input > parameters) and > | the duration. > | 6. I extended the supported calendars by using the getCalendar function > already > | available in calendars.cpp (there was a different getCalendar function > declared > | in the header which didn't have an implementation and I substituted it > with the > | correct declaration). > | > | I was wondering what you think of these changes. I would like to > contribute > | them back to the package, but I am worried about the fact the the need to > | extend the interface has broken backward compatibility for > FixedRateBond. I was > > I generally like backwards compatibility. > Me too, as long as it is possible. > > This may be an exception where it is worth breaking things. > Yes, I belive the current API is limited and not flexible enough for pricing bonds. > > | initially thinking of adding a new function with a different name, but I > | believe that would be very confusing for users. My believe is that the > | FixedRateBond should match as closely as possible the > QuantLib::FixedRateBond > | (even the name says that :)). > | If you think it would be worthile, I would implement similar changes to > the > | other bond functions in the package and contribute it back. > | > | Looking forward to hearing your opinion on this, > > Can you provide a 'pull request' ? That is the GitHub way of clearly > showing > the differences. If you know (some) git, creating a branch and a pull > request is easy. If you don't know git, it may be worth learning. We can > also fall back to 'diff and patch'. > Yes, git is my versioning tool of choice, I will clean things up a bit and provide a pull request. Michele > > This discussion should be on the mailing list, though, so I am reverting it > there. Please follow-up on list, if possible. > > Dirk > > | Michele > | > | > | On 1 October 2014 18:32, Dirk Eddelbuettel wrote: > | > | > | Hi again, > | > | On 1 October 2014 at 18:18, Michele Salvadore wrote: > | | Hi Dirk, > | | > | | sorry to bother you, I was wondering if you had the chance to take > a look > | at > | | this issue (multiple definitions at linkage). It looks like > something to > | do > | > | I have not. > | > | RQuantLib builds at CRAN incl on the win-builder service. > | > | | with proper header inclusion, but I'm not sure what's going on. > Btw, I > | was able > | | to get all other issues/warning sorted (including openmp and so > on), this > | is > | | the last bit left before being able to work on it. > | > | Can you construct a small reproducible example and post it (within > the 40kb > | limit, ie do not attach or include lots) to the list? > | > | Dirk > | > | | Thanks a lot, apologies for bothering! > | | > | | Michele > | | > | | On 26 September 2014 22:10, Dirk Eddelbuettel > wrote: > | | > | | > | | On 26 September 2014 at 20:48, Michele Salvadore wrote: > | | | Sorry about that dirk, will keep it shorter in the future :) > i was > | out of > | | Office today and saw emails just now. > | | > | | No worries. > | | > | | What is a little stranger is that I can see the post now in > the list > | | archives, yet I never seem to have gotten a copy to my account. > | | > | | We'll follow up in a bit. > | | > | | Dirk > | | > | | -- > | | http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org > | | > | | > | > | -- > | http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org > | > | > > -- > http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: From edd at debian.org Wed Oct 8 15:42:10 2014 From: edd at debian.org (Dirk Eddelbuettel) Date: Wed, 8 Oct 2014 08:42:10 -0500 Subject: [Rquantlib-devel] RQuantLib fixed-income discussion (Re: 1 Rquantlib-devel moderator request(s) waiting) In-Reply-To: References: <21541.20322.766800.846918@max.nulle.part> <21541.22633.278467.435646@max.nulle.part> <21541.51246.950057.469654@max.nulle.part> <21548.11418.918918.340419@max.nulle.part> <21557.9590.999103.396097@max.nulle.part> Message-ID: <21557.16178.212870.637345@max.nulle.part> On 8 October 2014 at 15:23, Michele Salvadore wrote: | On 8 October 2014 13:52, Dirk Eddelbuettel wrote: | On 8 October 2014 at 10:53, Michele Salvadore wrote: | | I was wondering what you think of these changes. I would like to | contribute | | them back to the package, but I am worried about the fact the the need to | | extend the interface has broken backward compatibility for FixedRateBond. | I was | | I generally like backwards compatibility. | | Me too, as long as it is possible.? We are on the same page. So let's see what we can do here. | Yes, git is my versioning tool of choice, I will clean things up a bit and | provide a pull request. Perfect. And then you probably know that the GH repo is currently quite a bit ahead of the CRAN version, so by all means use my GH sources. I think more work on fixed income was one of my possible goals for a 0.4.0 release -- so a pull request of yours may get us there. A lot of the other interfaces are simpler now thanks to Rcpp Attributes, but the signature has not changed so we preserved backwards compatitibility there, Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From michele.salvadore at gmail.com Thu Oct 9 12:12:16 2014 From: michele.salvadore at gmail.com (Michele Salvadore) Date: Thu, 9 Oct 2014 12:12:16 +0200 Subject: [Rquantlib-devel] RQuantLib fixed-income discussion (Re: 1 Rquantlib-devel moderator request(s) waiting) In-Reply-To: <21557.16178.212870.637345@max.nulle.part> References: <21541.20322.766800.846918@max.nulle.part> <21541.22633.278467.435646@max.nulle.part> <21541.51246.950057.469654@max.nulle.part> <21548.11418.918918.340419@max.nulle.part> <21557.9590.999103.396097@max.nulle.part> <21557.16178.212870.637345@max.nulle.part> Message-ID: I submitted a pull request from my fork. Currently I have committed only a first minor change (calendar support for bonds). I will incrementally commits additional self-contained changes in order to monitor and discuss each step separately. Maybe we can figure out a better way to preserve backward compatibility. On 8 October 2014 15:42, Dirk Eddelbuettel wrote: > > On 8 October 2014 at 15:23, Michele Salvadore wrote: > | On 8 October 2014 13:52, Dirk Eddelbuettel wrote: > | On 8 October 2014 at 10:53, Michele Salvadore wrote: > | | I was wondering what you think of these changes. I would like to > | contribute > | | them back to the package, but I am worried about the fact the the > need to > | | extend the interface has broken backward compatibility for > FixedRateBond. > | I was > | > | I generally like backwards compatibility. > | > | Me too, as long as it is possible. > > We are on the same page. So let's see what we can do here. > > | Yes, git is my versioning tool of choice, I will clean things up a bit > and > | provide a pull request. > > Perfect. > > And then you probably know that the GH repo is currently quite a bit ahead > of > the CRAN version, so by all means use my GH sources. I think more work on > fixed income was one of my possible goals for a 0.4.0 release -- so a pull > request of yours may get us there. A lot of the other interfaces are > simpler > now thanks to Rcpp Attributes, but the signature has not changed so we > preserved backwards compatitibility there, > > Dirk > > -- > http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: From edd at debian.org Thu Oct 9 13:26:37 2014 From: edd at debian.org (Dirk Eddelbuettel) Date: Thu, 9 Oct 2014 06:26:37 -0500 Subject: [Rquantlib-devel] RQuantLib fixed-income discussion (Re: 1 Rquantlib-devel moderator request(s) waiting) In-Reply-To: References: <21541.20322.766800.846918@max.nulle.part> <21541.22633.278467.435646@max.nulle.part> <21541.51246.950057.469654@max.nulle.part> <21548.11418.918918.340419@max.nulle.part> <21557.9590.999103.396097@max.nulle.part> <21557.16178.212870.637345@max.nulle.part> Message-ID: <21558.28909.966896.526611@max.nulle.part> On 9 October 2014 at 12:12, Michele Salvadore wrote: | I submitted a pull request from my fork. Currently I have committed only a | first minor change (calendar support for bonds). I will incrementally commits | additional self-contained changes in order to monitor and discuss each step | separately. Maybe we can figure out a better way to preserve backward | compatibility. That is a good approach. We could also use 'feature' branches for each new increment which is even more gradual. Now it turns out that the suggested change breaks the Travis auto-builder. That is something to avoid as we set up continuous integration to catch these things. The error happens right at the top of R CMD check: * checking whether package ?RQuantLib? can be installed ... ERROR Installation failed. See ?/home/travis/build/eddelbuettel/rquantlib/RQuantLib.Rcheck/00install.out? for details. But I don;t have access to the log... I also note that you switched to using auto -- RQuantLib is not (yet?) a C++11 project, and it may good to not force that just yet. So the failure may simply be that you request C++11 which is not turned in src/Makevars so it fails. Dirk | On 8 October 2014 15:42, Dirk Eddelbuettel wrote: | | | On 8 October 2014 at 15:23, Michele Salvadore wrote: | | On 8 October 2014 13:52, Dirk Eddelbuettel wrote: | |? ? ?On 8 October 2014 at 10:53, Michele Salvadore wrote: | |? ? ?| I was wondering what you think of these changes. I would like to | |? ? ?contribute | |? ? ?| them back to the package, but I am worried about the fact the the | need to | |? ? ?| extend the interface has broken backward compatibility for | FixedRateBond. | |? ? ?I was | | | |? ? ?I generally like backwards compatibility. | | | | Me too, as long as it is possible.? | | We are on the same page. So let's see what we can do here. | | | Yes, git is my versioning tool of choice, I will clean things up a bit | and | | provide a pull request. | | Perfect. | | And then you probably know that the GH repo is currently quite a bit ahead | of | the CRAN version, so by all means use my GH sources.? I think more work on | fixed income was one of my possible goals for a 0.4.0 release -- so a pull | request of yours may get us there.? A lot of the other interfaces are | simpler | now thanks to Rcpp Attributes, but the signature has not changed so we | preserved backwards compatitibility there, | | Dirk | | -- | http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org | | -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From michele.salvadore at gmail.com Thu Oct 9 15:55:30 2014 From: michele.salvadore at gmail.com (Michele Salvadore) Date: Thu, 9 Oct 2014 15:55:30 +0200 Subject: [Rquantlib-devel] RQuantLib fixed-income discussion (Re: 1 Rquantlib-devel moderator request(s) waiting) In-Reply-To: <21558.28909.966896.526611@max.nulle.part> References: <21541.20322.766800.846918@max.nulle.part> <21541.22633.278467.435646@max.nulle.part> <21541.51246.950057.469654@max.nulle.part> <21548.11418.918918.340419@max.nulle.part> <21557.9590.999103.396097@max.nulle.part> <21557.16178.212870.637345@max.nulle.part> <21558.28909.966896.526611@max.nulle.part> Message-ID: On 9 October 2014 13:26, Dirk Eddelbuettel wrote: > > On 9 October 2014 at 12:12, Michele Salvadore wrote: > | I submitted a pull request from my fork. Currently I have committed only > a > | first minor change (calendar support for bonds). I will incrementally > commits > | additional self-contained changes in order to monitor and discuss each > step > | separately. Maybe we can figure out a better way to preserve backward > | compatibility. > > That is a good approach. We could also use 'feature' branches for each new > increment which is even more gradual. > > Now it turns out that the suggested change breaks the Travis auto-builder. > That is something to avoid as we set up continuous integration to catch > these > things. The error happens right at the top of R CMD check: > > * checking whether package ?RQuantLib? can be installed ... ERROR > Installation failed. > See > ?/home/travis/build/eddelbuettel/rquantlib/RQuantLib.Rcheck/00install.out? > for details. > > But I don;t have access to the log... > > I also note that you switched to using auto -- RQuantLib is not (yet?) a > C++11 project, and it may good to not force that just yet. > I thought C++11 had to be switched on already in order to support for long long type, see your comment here: http://lists.r-forge.r-project.org/pipermail/rquantlib-devel/2014-September/000015.html Sorry about that, will revert to use explicit types. In regards to the build I apologize, unfortunately I am stuck on a windows box for this project and I am struggling a bit with the platform. Any chance you recall how the win-builder get around the issue with the long long type discussed in the thread above without -std=c++0x? > > So the failure may simply be that you request C++11 which is not turned in > src/Makevars so it fails. > > Dirk > > | On 8 October 2014 15:42, Dirk Eddelbuettel wrote: > | > | > | On 8 October 2014 at 15:23, Michele Salvadore wrote: > | | On 8 October 2014 13:52, Dirk Eddelbuettel wrote: > | | On 8 October 2014 at 10:53, Michele Salvadore wrote: > | | | I was wondering what you think of these changes. I would > like to > | | contribute > | | | them back to the package, but I am worried about the fact > the the > | need to > | | | extend the interface has broken backward compatibility for > | FixedRateBond. > | | I was > | | > | | I generally like backwards compatibility. > | | > | | Me too, as long as it is possible. > | > | We are on the same page. So let's see what we can do here. > | > | | Yes, git is my versioning tool of choice, I will clean things up a > bit > | and > | | provide a pull request. > | > | Perfect. > | > | And then you probably know that the GH repo is currently quite a bit > ahead > | of > | the CRAN version, so by all means use my GH sources. I think more > work on > | fixed income was one of my possible goals for a 0.4.0 release -- so > a pull > | request of yours may get us there. A lot of the other interfaces are > | simpler > | now thanks to Rcpp Attributes, but the signature has not changed so > we > | preserved backwards compatitibility there, > | > | Dirk > | > | -- > | http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org > | > | > > -- > http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: From edd at debian.org Thu Oct 9 16:23:47 2014 From: edd at debian.org (Dirk Eddelbuettel) Date: Thu, 9 Oct 2014 09:23:47 -0500 Subject: [Rquantlib-devel] RQuantLib fixed-income discussion (Re: 1 Rquantlib-devel moderator request(s) waiting) In-Reply-To: References: <21541.20322.766800.846918@max.nulle.part> <21541.22633.278467.435646@max.nulle.part> <21541.51246.950057.469654@max.nulle.part> <21548.11418.918918.340419@max.nulle.part> <21557.9590.999103.396097@max.nulle.part> <21557.16178.212870.637345@max.nulle.part> <21558.28909.966896.526611@max.nulle.part> Message-ID: <21558.39539.766982.532480@max.nulle.part> On 9 October 2014 at 15:55, Michele Salvadore wrote: | On 9 October 2014 13:26, Dirk Eddelbuettel wrote: | Now it turns out that the suggested change breaks the Travis auto-builder. | That is something to avoid as we set up continuous integration to catch | these | things. The error happens right at the top of R CMD check: | | ? * checking whether package ?RQuantLib? can be installed ... ERROR | ? Installation failed. | ? See ?/home/travis/build/eddelbuettel/rquantlib/RQuantLib.Rcheck/ | 00install.out? for details. | | But I don;t have access to the log... | | I also note that you switched to using auto -- RQuantLib is not (yet?) a | C++11 project, and it may good to not force that just yet. | | ? | I thought C++11 had to be switched on already in order to support for long long | type, see your comment here: | http://lists.r-forge.r-project.org/pipermail/rquantlib-devel/2014-September/ | 000015.html It was a guess of mine, the code may also fail to build for other reasons. But I think it would be preferable for you to keep the repo buildable ;-) So let's fix this now before adding further pull requests, or expanding the current one. | Sorry about that, will revert to use explicit types. | In regards to the build I apologize, unfortunately I am stuck on a windows box | for this project and I am struggling a bit with the platform. Any chance you | recall how the win-builder get around the issue with the long long type | discussed in the thread above without?-std=c++0x? win-builder has not changed in a while, and RQuantLib passed all tests when uploaded. CRAN also continues to build and test once released --- the best of why knowledge would be encoded on src/Makevars.win. And as you can see there are no particular switches. Can you remind me what the issue is, then? Boost usage from R tends to issue copious __warnings__ about long long but still builds. I may have been refering to suppressing the warning by turning on C++11, but I am not doing that yet for RQuantLib. Hope this clarifies things and helps, Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From edd at debian.org Thu Oct 9 20:58:04 2014 From: edd at debian.org (Dirk Eddelbuettel) Date: Thu, 9 Oct 2014 13:58:04 -0500 Subject: [Rquantlib-devel] RQuantLib request In-Reply-To: <1412878273070.54445@sfdph.org> References: <1412878273070.54445@sfdph.org> Message-ID: <21558.55996.747707.3978@max.nulle.part> Harold, I am CCing this to the rquantlib-devel list ... which is mostly dormant, but the best place to discuss extensions. It had some traffic this week though, and I have to ask you to subscribe to post there in case you want to follow-up. On 9 October 2014 at 18:11, Baize, Harold (DPH) wrote: | Dirk Eddelbuettel, Well I usually joke that it has to either be Dr Eddelbuettel if you want to be formal, or just Dirk. The latter is shorter :) | I hope you will consider this request for RQuantLib. I often need to find the | business days between two dates using the holidays of California. This differs | from the UnitedStates holidays by adding Ceasar Chavez Day and the day after | Thanksgiving. My request is for RQuantLib to include the "addHoliday" and | "removeHoliday" functions found in QuantLib, so the calendar can be customized | to local holidays. Nice idea. I like it. I am a bit on the overcommitted side so I can't promise that I get to any time soon. You can always add a "proxy layer" of getting the calendar from RQuantLib, grab the result (and maybe store it somewhere) and then programmatically add Ceasar Chavez to that result set -- and provide yourself and your users a way to query the altered / augmented result set. | Thank you for your work. Always a pleasure. Dirk | Harold R. Baize, PhD | Data Analyst | Office of Quality Management | Department of Public Health | San Francisco Health Network | 1380 Howard St., Rm 224e | San Francisco, CA 94103 | 415-255-3690 | Fax 415-252-3030 | | -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From michele.salvadore at gmail.com Fri Oct 10 08:51:17 2014 From: michele.salvadore at gmail.com (Michele Salvadore) Date: Fri, 10 Oct 2014 08:51:17 +0200 Subject: [Rquantlib-devel] RQuantLib fixed-income discussion (Re: 1 Rquantlib-devel moderator request(s) waiting) In-Reply-To: <21558.39539.766982.532480@max.nulle.part> References: <21541.20322.766800.846918@max.nulle.part> <21541.22633.278467.435646@max.nulle.part> <21541.51246.950057.469654@max.nulle.part> <21548.11418.918918.340419@max.nulle.part> <21557.9590.999103.396097@max.nulle.part> <21557.16178.212870.637345@max.nulle.part> <21558.28909.966896.526611@max.nulle.part> <21558.39539.766982.532480@max.nulle.part> Message-ID: On 9 October 2014 16:23, Dirk Eddelbuettel wrote: > > On 9 October 2014 at 15:55, Michele Salvadore wrote: > | On 9 October 2014 13:26, Dirk Eddelbuettel wrote: > | Now it turns out that the suggested change breaks the Travis > auto-builder. > | That is something to avoid as we set up continuous integration to > catch > | these > | things. The error happens right at the top of R CMD check: > | > | * checking whether package ?RQuantLib? can be installed ... ERROR > | Installation failed. > | See ?/home/travis/build/eddelbuettel/rquantlib/RQuantLib.Rcheck/ > | 00install.out? for details. > | > | But I don;t have access to the log... > | > | I also note that you switched to using auto -- RQuantLib is not > (yet?) a > | C++11 project, and it may good to not force that just yet. > | > | > | I thought C++11 had to be switched on already in order to support for > long long > | type, see your comment here: > | > http://lists.r-forge.r-project.org/pipermail/rquantlib-devel/2014-September/ > | 000015.html > > It was a guess of mine, the code may also fail to build for other reasons. > > But I think it would be preferable for you to keep the repo buildable ;-) > So let's fix this now before adding further pull requests, or expanding the > current one. > totally agree, it was indeed my intention to push only buildable commits :/ > | Sorry about that, will revert to use explicit types. > | In regards to the build I apologize, unfortunately I am stuck on a > windows box > | for this project and I am struggling a bit with the platform. Any chance > you > | recall how the win-builder get around the issue with the long long type > | discussed in the thread above without -std=c++0x? > > win-builder has not changed in a while, and RQuantLib passed all tests when > uploaded. CRAN also continues to build and test once released --- the best > of why knowledge would be encoded on src/Makevars.win. And as you can see > there are no particular switches. > > Can you remind me what the issue is, then? Boost usage from R tends to > issue copious __warnings__ about long long but still builds. I may have > been > refering to suppressing the warning by turning on C++11, but I am not doing > that yet for RQuantLib. > Sure: in order to get my build rolling and the windows box I had to add the following switches on src/Makevars.win: PKG_CXXFLAGS=-I$(QUANTLIB_ROOT) -I../inst/include -I. -I$(BOOSTLIB) $(SHLIB_OPENMP_CFLAGS) -std=c++0x PKG_LIBS=-L$(QUANTLIB_ROOT)/lib${R_ARCH} -lQuantLib $(SHLIB_OPENMP_CFLAGS) -Wl,--allow-multiple-definition (the $(SHLIB_OPENMP_CFLAGS) and $(SHLIB_OPENMP_CFLAGS) get the openMP pragma warnings out of the way) without the -Wl,--allow-multiple-definition the linker is not happy, as it produces a huge amount of multiple definition errors like the following one: asian.o:asian.cpp:(.text+0x2f20): multiple definition of `SEXPREC* Rcpp::wrap(QuantLib::Date const&)' RcppExports.o:RcppExports.cpp:(.text+0x4250): first defined here If I also switch off -stdC++0x, the compilation fails because of "invalid conversion from 'SEXP' to 'long long unsigned int": g++ -m64 -I"C:/PROGRA~1/R/R-31~1.1/include" -I"C:/Program Files/R/R-3.1.1/library/Rcpp/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include" -I"C:/workspace/lib/QuantLib/Quantlib14" -I../inst/include -I. -I"C:/workspace/lib/boost/boost_1_56_0" -fopenmp -O3 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o In file included from C:/Program Files/R/R-3.1.1/library/Rcpp/include/Rcpp/as.h:25:0, from C:/Program Files/R/R-3.1.1/library/Rcpp/include/RcppCommon.h:169, from ../inst/include/rquantlib_internal.h:30, from ../inst/include/RQuantLib.h:23, from RcppExports.cpp:4: C:/Program Files/R/R-3.1.1/library/Rcpp/include/Rcpp/internal/Exporter.h: In constructor 'Rcpp::traits::Exporter::Exporter(SEXP) [with T = long long unsigned int, SEXP = SEXPREC*]': C:/Program Files/R/R-3.1.1/library/Rcpp/include/Rcpp/as.h:79:51: instantiated from 'T Rcpp::internal::as(SEXP, Rcpp::traits::r_type_generic_tag) [with T = long long unsigned int, SEXP = SEXPREC*]' C:/Program Files/R/R-3.1.1/library/Rcpp/include/Rcpp/as.h:144:84: instantiated from 'T Rcpp::as(SEXP) [with T = long long unsigned int, SEXP = SEXPREC*]' C:/Program Files/R/R-3.1.1/library/Rcpp/include/Rcpp/InputParameter.h:34:45: instantiated from 'Rcpp::InputParameter::operator T() [with T = long long unsigned int]' RcppExports.cpp:29:161: instantiated from here C:/Program Files/R/R-3.1.1/library/Rcpp/include/Rcpp/internal/Exporter.h:31:31: error: invalid conversion from 'SEXP' to 'long long unsigned int' [-fpermissive] The latter can be turned into a warning with the flag -fpermissive, is that the way to go? I am not sure as in the Makevars.win there is neither. I am going to branch out my commits in my github and try to get the CI on travis working before merging back, but it would be really useful to access that log file... > Hope this clarifies things and helps, Dirk > > > > -- > http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: From edd at debian.org Sat Oct 11 21:13:19 2014 From: edd at debian.org (Dirk Eddelbuettel) Date: Sat, 11 Oct 2014 14:13:19 -0500 Subject: [Rquantlib-devel] RQuantLib fixed-income discussion (Re: 1 Rquantlib-devel moderator request(s) waiting) In-Reply-To: References: <21541.20322.766800.846918@max.nulle.part> <21541.22633.278467.435646@max.nulle.part> <21541.51246.950057.469654@max.nulle.part> <21548.11418.918918.340419@max.nulle.part> <21557.9590.999103.396097@max.nulle.part> <21557.16178.212870.637345@max.nulle.part> <21558.28909.966896.526611@max.nulle.part> <21558.39539.766982.532480@max.nulle.part> Message-ID: <21561.33103.517964.745274@max.nulle.part> Michele, Sorry, missed this email earlier. On 10 October 2014 at 08:51, Michele Salvadore wrote: | | On 9 October 2014 16:23, Dirk Eddelbuettel wrote: | | win-builder has not changed in a while, and RQuantLib passed all tests when | uploaded.? CRAN also continues to build and test once released --- the best | of why knowledge would be encoded on src/Makevars.win.? And as you can see | there are no particular switches. | | Can you remind me what the issue is, then?? ?Boost usage from R tends to | issue copious __warnings__ about long long but still builds.? I may have | been | refering to suppressing the warning by turning on C++11, but I am not doing | that yet for RQuantLib. | | ?Sure: in order to get my build rolling and the windows box I had to add the | following switches on src/Makevars.win: | | PKG_CXXFLAGS=-I$(QUANTLIB_ROOT) -I../inst/include -I. -I$(BOOSTLIB) $ | (SHLIB_OPENMP_CFLAGS) -std=c++0x | PKG_LIBS=-L$(QUANTLIB_ROOT)/lib${R_ARCH} -lQuantLib $(SHLIB_OPENMP_CFLAGS) | -Wl,--allow-multiple-definition That is a little strange, and I have no lead. In essence, QuantLib and Boost have not changed, and CRAN was able to process the QuantLib 1.4-based rebuild just fine. | (the $(SHLIB_OPENMP_CFLAGS) and $(SHLIB_OPENMP_CFLAGS) get the openMP pragma | warnings out of the way) | | without the -Wl,--allow-multiple-definition the linker is not happy, as it | produces a huge amount of multiple definition errors like the following one: | | asian.o:asian.cpp:(.text+0x2f20): multiple definition of `SEXPREC* Rcpp::wrap | (QuantLib::Date const&)' | RcppExports.o:RcppExports.cpp:(.text+0x4250): first defined here Oh, I am starting the smell the bacon. My thinking was faulty. The previous builds all passed -- it was still the old code setup. Since then I have changed the code to switch to using Rcpp Attributes and newer Rcpp features, and nobody had tried that on Windows before you did! So there may well be something going on with Windows. That said, everything I committed passed under Travis CI on Linux, as well as (of course) on my Linux box. | If I also switch off -stdC++0x, the compilation fails because of "invalid | conversion from 'SEXP' to 'long long unsigned int": Ok, the recent changes may well require this. We have plugins for Rcpp which will get R to select -std=c++0x (on Windows, using g++-4.6.*) and -std=c++11 (on Linux and OS X). So for now do keep this in src/Makevars.win | g++ -m64 -I"C:/PROGRA~1/R/R-31~1.1/include" ? ? ? -I"C:/Program Files/R/R-3.1.1 | /library/Rcpp/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include" ?-I"C: | /workspace/lib/QuantLib/Quantlib14" -I../inst/include -I. -I"C:/workspace/lib/ | boost/boost_1_56_0" -fopenmp ? -O3 -Wall ?-mtune=core2 ? -c RcppExports.cpp -o | RcppExports.o | In file included from C:/Program Files/R/R-3.1.1/library/Rcpp/include/Rcpp/ | as.h:25:0, | ? ? ? ? ? ? ? ? ?from C:/Program Files/R/R-3.1.1/library/Rcpp/include/ | RcppCommon.h:169, | ? ? ? ? ? ? ? ? ?from ../inst/include/rquantlib_internal.h:30, | ? ? ? ? ? ? ? ? ?from ../inst/include/RQuantLib.h:23, | ? ? ? ? ? ? ? ? ?from RcppExports.cpp:4: | C:/Program Files/R/R-3.1.1/library/Rcpp/include/Rcpp/internal/Exporter.h: In | constructor 'Rcpp::traits::Exporter::Exporter(SEXP) [with T = long long | unsigned int, SEXP = SEXPREC*]': | C:/Program Files/R/R-3.1.1/library/Rcpp/include/Rcpp/as.h:79:51: ? instantiated | from 'T Rcpp::internal::as(SEXP, Rcpp::traits::r_type_generic_tag) [with T = | long long unsigned int, SEXP = SEXPREC*]' | C:/Program Files/R/R-3.1.1/library/Rcpp/include/Rcpp/as.h:144:84: ? | instantiated from 'T Rcpp::as(SEXP) [with T = long long unsigned int, SEXP = | SEXPREC*]' | C:/Program Files/R/R-3.1.1/library/Rcpp/include/Rcpp/InputParameter.h:34:45: ? | instantiated from 'Rcpp::InputParameter::operator T() [with T = long long | unsigned int]' | RcppExports.cpp:29:161: ? instantiated from here | C:/Program Files/R/R-3.1.1/library/Rcpp/include/Rcpp/internal/Exporter.h:31:31: | error: invalid conversion from 'SEXP' to 'long long unsigned int' | [-fpermissive] | | The latter can be turned into a warning with the flag?-fpermissive, is that the | way to go? I am not sure as in the Makevars.win there is neither. | | I am going to branch out my commits in my github and try to get the CI on | travis working before merging back, but it would be really useful to access | that log file... I don't want you stuck in a dead-end either. If you have your commits as a clean diff somewhere, I could at least try them here. We need to disentangle -- your issues on Windows, which may well be due to my code changes since the last release -- whether your commits build fine otherwise so that we can focus on 2) rather than 1) Cheers, Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From burgoadr at students.zhaw.ch Mon Oct 13 14:58:20 2014 From: burgoadr at students.zhaw.ch (Burgos Adrian (burgoadr)) Date: Mon, 13 Oct 2014 12:58:20 +0000 Subject: [Rquantlib-devel] Question, Rquantlib for Apple OS X 10.9.5 Message-ID: <5B555C0B14034449A7313A953E9935062158060A@srv-mail-511> Dear Dr. Eddelbuettel For our Schoolproject we want to use your Package RQuantlib with the function Discountcurve. Our problem is now that we are using a Macbook Pro with Mavericks. Is RQuantlib not available for the Mavericks system? Is there another Solution to use it with Mac? We are really appreciate for your time. And thank you very much for your response. Respectfully yours, Adrian -------------- next part -------------- An HTML attachment was scrubbed... URL: From michele.salvadore at gmail.com Tue Oct 14 10:11:25 2014 From: michele.salvadore at gmail.com (Michele Salvadore) Date: Tue, 14 Oct 2014 10:11:25 +0200 Subject: [Rquantlib-devel] RQuantLib fixed-income discussion (Re: 1 Rquantlib-devel moderator request(s) waiting) In-Reply-To: <21561.33103.517964.745274@max.nulle.part> References: <21541.20322.766800.846918@max.nulle.part> <21541.22633.278467.435646@max.nulle.part> <21541.51246.950057.469654@max.nulle.part> <21548.11418.918918.340419@max.nulle.part> <21557.9590.999103.396097@max.nulle.part> <21557.16178.212870.637345@max.nulle.part> <21558.28909.966896.526611@max.nulle.part> <21558.39539.766982.532480@max.nulle.part> <21561.33103.517964.745274@max.nulle.part> Message-ID: On 11 October 2014 21:13, Dirk Eddelbuettel wrote: > > Michele, > > Sorry, missed this email earlier. > > On 10 October 2014 at 08:51, Michele Salvadore wrote: > | > | On 9 October 2014 16:23, Dirk Eddelbuettel wrote: > | > | win-builder has not changed in a while, and RQuantLib passed all > tests when > | uploaded. CRAN also continues to build and test once released --- > the best > | of why knowledge would be encoded on src/Makevars.win. And as you > can see > | there are no particular switches. > | > | Can you remind me what the issue is, then? Boost usage from R > tends to > | issue copious __warnings__ about long long but still builds. I may > have > | been > | refering to suppressing the warning by turning on C++11, but I am > not doing > | that yet for RQuantLib. > | > | Sure: in order to get my build rolling and the windows box I had to add > the > | following switches on src/Makevars.win: > | > | PKG_CXXFLAGS=-I$(QUANTLIB_ROOT) -I../inst/include -I. -I$(BOOSTLIB) $ > | (SHLIB_OPENMP_CFLAGS) -std=c++0x > | PKG_LIBS=-L$(QUANTLIB_ROOT)/lib${R_ARCH} -lQuantLib > $(SHLIB_OPENMP_CFLAGS) > | -Wl,--allow-multiple-definition > > That is a little strange, and I have no lead. > > In essence, QuantLib and Boost have not changed, and CRAN was able to > process > the QuantLib 1.4-based rebuild just fine. > > | (the $(SHLIB_OPENMP_CFLAGS) and $(SHLIB_OPENMP_CFLAGS) get the openMP > pragma > | warnings out of the way) > | > | without the -Wl,--allow-multiple-definition the linker is not happy, as > it > | produces a huge amount of multiple definition errors like the following > one: > | > | asian.o:asian.cpp:(.text+0x2f20): multiple definition of `SEXPREC* > Rcpp::wrap > | (QuantLib::Date const&)' > | RcppExports.o:RcppExports.cpp:(.text+0x4250): first defined here > > Oh, I am starting the smell the bacon. My thinking was faulty. > > The previous builds all passed -- it was still the old code setup. Since > then > I have changed the code to switch to using Rcpp Attributes and newer Rcpp > features, and nobody had tried that on Windows before you did! > > So there may well be something going on with Windows. > > That said, everything I committed passed under Travis CI on Linux, as well > as > (of course) on my Linux box. > > | If I also switch off -stdC++0x, the compilation fails because of "invalid > | conversion from 'SEXP' to 'long long unsigned int": > > Ok, the recent changes may well require this. > > We have plugins for Rcpp which will get R to select -std=c++0x (on Windows, > using g++-4.6.*) and -std=c++11 (on Linux and OS X). > > So for now do keep this in src/Makevars.win > > | g++ -m64 -I"C:/PROGRA~1/R/R-31~1.1/include" -I"C:/Program > Files/R/R-3.1.1 > | /library/Rcpp/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include" > -I"C: > | /workspace/lib/QuantLib/Quantlib14" -I../inst/include -I. > -I"C:/workspace/lib/ > | boost/boost_1_56_0" -fopenmp -O3 -Wall -mtune=core2 -c > RcppExports.cpp -o > | RcppExports.o > | In file included from C:/Program > Files/R/R-3.1.1/library/Rcpp/include/Rcpp/ > | as.h:25:0, > | from C:/Program Files/R/R-3.1.1/library/Rcpp/include/ > | RcppCommon.h:169, > | from ../inst/include/rquantlib_internal.h:30, > | from ../inst/include/RQuantLib.h:23, > | from RcppExports.cpp:4: > | C:/Program > Files/R/R-3.1.1/library/Rcpp/include/Rcpp/internal/Exporter.h: In > | constructor 'Rcpp::traits::Exporter::Exporter(SEXP) [with T = long > long > | unsigned int, SEXP = SEXPREC*]': > | C:/Program Files/R/R-3.1.1/library/Rcpp/include/Rcpp/as.h:79:51: > instantiated > | from 'T Rcpp::internal::as(SEXP, Rcpp::traits::r_type_generic_tag) [with > T = > | long long unsigned int, SEXP = SEXPREC*]' > | C:/Program Files/R/R-3.1.1/library/Rcpp/include/Rcpp/as.h:144:84: > | instantiated from 'T Rcpp::as(SEXP) [with T = long long unsigned int, > SEXP = > | SEXPREC*]' > | C:/Program > Files/R/R-3.1.1/library/Rcpp/include/Rcpp/InputParameter.h:34:45: > | instantiated from 'Rcpp::InputParameter::operator T() [with T = long > long > | unsigned int]' > | RcppExports.cpp:29:161: instantiated from here > | C:/Program > Files/R/R-3.1.1/library/Rcpp/include/Rcpp/internal/Exporter.h:31:31: > | error: invalid conversion from 'SEXP' to 'long long unsigned int' > | [-fpermissive] > | > | The latter can be turned into a warning with the flag -fpermissive, is > that the > | way to go? I am not sure as in the Makevars.win there is neither. > | > | I am going to branch out my commits in my github and try to get the CI on > | travis working before merging back, but it would be really useful to > access > | that log file... > > I don't want you stuck in a dead-end either. If you have your commits as a > clean diff somewhere, I could at least try them here. > > We need to disentangle > > -- your issues on Windows, which may well be due to my code changes since > the last release > > -- whether your commits build fine otherwise > > so that we can focus on 2) rather than 1) > OK, the travis CI build passes now, I've pushed by commits upstream to the pull request and the build was OK on your side as well finally. Let me know what you think or the changes and if you can merge the pull request. If you are good with that, I have additional changes ready which implement the features I described earlier on. For the time being, I am keeping the switches above on my box (actually I am using -fpermissive rather than the c++0) in order to compile, but I don't commit them upstream. I guess we will have to tackle this at some point before a new windows release can be made available... Cheers, Michele > > Cheers, Dirk > > -- > http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: From edd at debian.org Tue Oct 14 14:15:40 2014 From: edd at debian.org (Dirk Eddelbuettel) Date: Tue, 14 Oct 2014 07:15:40 -0500 Subject: [Rquantlib-devel] Question, Rquantlib for Apple OS X 10.9.5 In-Reply-To: <5B555C0B14034449A7313A953E9935062158060A@srv-mail-511> References: <5B555C0B14034449A7313A953E9935062158060A@srv-mail-511> Message-ID: <21565.5100.166166.149283@max.nulle.part> Hi Adrian, On 13 October 2014 at 12:58, Burgos Adrian (burgoadr) wrote: | For our Schoolproject we want to use your Package RQuantlib with the function | Discountcurve. Our problem is now that we are using a Macbook Pro with | Mavericks. | | Is RQuantlib not available for the Mavericks system? Is there another Solution | to use it with Mac? You may just have to install QuantLib from source, followed by an RQuantLib installation from source. | We are really appreciate for your time. And thank you very much for your | response. I have never owned a Mac, so I can't really help with specifics. Some list readers may though. It might be worthwhile pooling some resources to get better support on OS X for this -- if there is sufficient interest. Best regards, Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From edd at debian.org Tue Oct 14 14:18:32 2014 From: edd at debian.org (Dirk Eddelbuettel) Date: Tue, 14 Oct 2014 07:18:32 -0500 Subject: [Rquantlib-devel] RQuantLib fixed-income discussion (Re: 1 Rquantlib-devel moderator request(s) waiting) In-Reply-To: References: <21541.20322.766800.846918@max.nulle.part> <21541.22633.278467.435646@max.nulle.part> <21541.51246.950057.469654@max.nulle.part> <21548.11418.918918.340419@max.nulle.part> <21557.9590.999103.396097@max.nulle.part> <21557.16178.212870.637345@max.nulle.part> <21558.28909.966896.526611@max.nulle.part> <21558.39539.766982.532480@max.nulle.part> <21561.33103.517964.745274@max.nulle.part> Message-ID: <21565.5272.662787.214580@max.nulle.part> On 14 October 2014 at 10:11, Michele Salvadore wrote: | OK, the travis CI build passes now, I've pushed by commits upstream to the pull | request and the build was OK on your side as well finally. Let me know what you | think or the changes and if you can merge the pull request. If you are good | with that, I have additional changes ready which implement the features I | described earlier on. Perfect. Give me a day or two to digest this, and to look into what is needed to accomodate Windows builds. | For the time being, I am keeping the switches above on my box (actually I am | using -fpermissive rather than the c++0) in order to compile, but I don't | commit them upstream. I guess we will have to tackle this at some point before | a new windows release can be made available...? Yep. Thanks again! Very nice to see some fresh contributions. Cheers, Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From edd at debian.org Tue Oct 14 17:20:31 2014 From: edd at debian.org (Dirk Eddelbuettel) Date: Tue, 14 Oct 2014 10:20:31 -0500 Subject: [Rquantlib-devel] RQuantLib fixed-income discussion moderator request(s) waiting) In-Reply-To: <21565.5272.662787.214580@max.nulle.part> References: <21541.20322.766800.846918@max.nulle.part> <21541.22633.278467.435646@max.nulle.part> <21541.51246.950057.469654@max.nulle.part> <21548.11418.918918.340419@max.nulle.part> <21557.9590.999103.396097@max.nulle.part> <21557.16178.212870.637345@max.nulle.part> <21558.28909.966896.526611@max.nulle.part> <21558.39539.766982.532480@max.nulle.part> <21561.33103.517964.745274@max.nulle.part> <21565.5272.662787.214580@max.nulle.part> Message-ID: <21565.16191.830981.716786@max.nulle.part> Michele, That pull request was excellent. Compiles without a single warning on Linux, and only fails on Windows because of Actual365NoLeap which is new(ly renamed) in QL 1.4 -- so I put an email into Uwe to double check if winbuilder still uses an older QuantLib. The symbol is in the headers of the complementary zipfile at http://www.stats.ox.ac.uk/pub/Rtools/goodies/multilib/ I'll keep you posted, but thanks again for a very fine contribution. [1] Dirk [1] I added a ChangeLog entry to the repo, feel free to edit as you see fit. -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From michele.salvadore at gmail.com Tue Oct 14 17:32:13 2014 From: michele.salvadore at gmail.com (Michele Salvadore) Date: Tue, 14 Oct 2014 17:32:13 +0200 Subject: [Rquantlib-devel] RQuantLib fixed-income discussion moderator request(s) waiting) In-Reply-To: <21565.16191.830981.716786@max.nulle.part> References: <21541.20322.766800.846918@max.nulle.part> <21541.22633.278467.435646@max.nulle.part> <21541.51246.950057.469654@max.nulle.part> <21548.11418.918918.340419@max.nulle.part> <21557.9590.999103.396097@max.nulle.part> <21557.16178.212870.637345@max.nulle.part> <21558.28909.966896.526611@max.nulle.part> <21558.39539.766982.532480@max.nulle.part> <21561.33103.517964.745274@max.nulle.part> <21565.5272.662787.214580@max.nulle.part> <21565.16191.830981.716786@max.nulle.part> Message-ID: Dirk, Glad you liked it :) Sorry about the Actual365NoLeap, I didn't notice it! Michele On 14 October 2014 17:20, Dirk Eddelbuettel wrote: > > Michele, > > That pull request was excellent. Compiles without a single warning on > Linux, > and only fails on Windows because of Actual365NoLeap which is new(ly > renamed) > in QL 1.4 -- so I put an email into Uwe to double check if winbuilder still > uses an older QuantLib. The symbol is in the headers of the complementary > zipfile at http://www.stats.ox.ac.uk/pub/Rtools/goodies/multilib/ > > I'll keep you posted, but thanks again for a very fine contribution. [1] > > Dirk > > [1] I added a ChangeLog entry to the repo, feel free to edit as you see > fit. > > -- > http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: From edd at debian.org Tue Oct 14 17:55:05 2014 From: edd at debian.org (Dirk Eddelbuettel) Date: Tue, 14 Oct 2014 10:55:05 -0500 Subject: [Rquantlib-devel] RQuantLib fixed-income discussion moderator request(s) waiting) In-Reply-To: References: <21541.20322.766800.846918@max.nulle.part> <21541.22633.278467.435646@max.nulle.part> <21541.51246.950057.469654@max.nulle.part> <21548.11418.918918.340419@max.nulle.part> <21557.9590.999103.396097@max.nulle.part> <21557.16178.212870.637345@max.nulle.part> <21558.28909.966896.526611@max.nulle.part> <21558.39539.766982.532480@max.nulle.part> <21561.33103.517964.745274@max.nulle.part> <21565.5272.662787.214580@max.nulle.part> <21565.16191.830981.716786@max.nulle.part> Message-ID: <21565.18265.549622.675782@max.nulle.part> Michele, On 14 October 2014 at 17:32, Michele Salvadore wrote: | Dirk, | | Glad you liked it :) | Sorry about the?Actual365NoLeap, I didn't notice it! It is not your fault; this builds fine under QuantLib 1.4 via Travis CI and on my box. I suspect the win-builder machine is at fault. Also note that the build proceeds without an issue til it hits that file: install for i386 * installing *source* package 'RQuantLib' ... ********************************************** WARNING: this package has a configure script It probably needs manual configuration ********************************************** ** libs g++ -I"D:/RCompile/recent/R/include" -I"d:/RCompile/CRANpkg/lib/3.2/Rcpp/include" -I"d:/Rcompile/CRANpkg/extralibs215/local215/include" -Id:/Rcompile/CRANpkg/extralibs215/QuantLib -I../inst/include -I. -Id:/Rcompile/CRANpkg/extralibs/boost -O3 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o g++ -I"D:/RCompile/recent/R/include" -I"d:/RCompile/CRANpkg/lib/3.2/Rcpp/include" -I"d:/Rcompile/CRANpkg/extralibs215/local215/include" -Id:/Rcompile/CRANpkg/extralibs215/QuantLib -I../inst/include -I. -Id:/Rcompile/CRANpkg/extralibs/boost -O3 -Wall -mtune=core2 -c asian.cpp -o asian.o g++ -I"D:/RCompile/recent/R/include" -I"d:/RCompile/CRANpkg/lib/3.2/Rcpp/include" -I"d:/Rcompile/CRANpkg/extralibs215/local215/include" -Id:/Rcompile/CRANpkg/extralibs215/QuantLib -I../inst/include -I. -Id:/Rcompile/CRANpkg/extralibs/boost -O3 -Wall -mtune=core2 -c barrier_binary.cpp -o barrier_binary.o g++ -I"D:/RCompile/recent/R/include" -I"d:/RCompile/CRANpkg/lib/3.2/Rcpp/include" -I"d:/Rcompile/CRANpkg/extralibs215/local215/include" -Id:/Rcompile/CRANpkg/extralibs215/QuantLib -I../inst/include -I. -Id:/Rcompile/CRANpkg/extralibs/boost -O3 -Wall -mtune=core2 -c bermudan.cpp -o bermudan.o g++ -I"D:/RCompile/recent/R/include" -I"d:/RCompile/CRANpkg/lib/3.2/Rcpp/include" -I"d:/Rcompile/CRANpkg/extralibs215/local215/include" -Id:/Rcompile/CRANpkg/extralibs215/QuantLib -I../inst/include -I. -Id:/Rcompile/CRANpkg/extralibs/boost -O3 -Wall -mtune=core2 -c bonds.cpp -o bonds.o g++ -I"D:/RCompile/recent/R/include" -I"d:/RCompile/CRANpkg/lib/3.2/Rcpp/include" -I"d:/Rcompile/CRANpkg/extralibs215/local215/include" -Id:/Rcompile/CRANpkg/extralibs215/QuantLib -I../inst/include -I. -Id:/Rcompile/CRANpkg/extralibs/boost -O3 -Wall -mtune=core2 -c calendars.cpp -o calendars.o g++ -I"D:/RCompile/recent/R/include" -I"d:/RCompile/CRANpkg/lib/3.2/Rcpp/include" -I"d:/Rcompile/CRANpkg/extralibs215/local215/include" -Id:/Rcompile/CRANpkg/extralibs215/QuantLib -I../inst/include -I. -Id:/Rcompile/CRANpkg/extralibs/boost -O3 -Wall -mtune=core2 -c curves.cpp -o curves.o g++ -I"D:/RCompile/recent/R/include" -I"d:/RCompile/CRANpkg/lib/3.2/Rcpp/include" -I"d:/Rcompile/CRANpkg/extralibs215/local215/include" -Id:/Rcompile/CRANpkg/extralibs215/QuantLib -I../inst/include -I. -Id:/Rcompile/CRANpkg/extralibs/boost -O3 -Wall -mtune=core2 -c dates.cpp -o dates.o g++ -I"D:/RCompile/recent/R/include" -I"d:/RCompile/CRANpkg/lib/3.2/Rcpp/include" -I"d:/Rcompile/CRANpkg/extralibs215/local215/include" -Id:/Rcompile/CRANpkg/extralibs215/QuantLib -I../inst/include -I. -Id:/Rcompile/CRANpkg/extralibs/boost -O3 -Wall -mtune=core2 -c daycounter.cpp -o daycounter.o g++ -I"D:/RCompile/recent/R/include" -I"d:/RCompile/CRANpkg/lib/3.2/Rcpp/include" -I"d:/Rcompile/CRANpkg/extralibs215/local215/include" -Id:/Rcompile/CRANpkg/extralibs215/QuantLib -I../inst/include -I. -Id:/Rcompile/CRANpkg/extralibs/boost -O3 -Wall -mtune=core2 -c discount.cpp -o discount.o g++ -I"D:/RCompile/recent/R/include" -I"d:/RCompile/CRANpkg/lib/3.2/Rcpp/include" -I"d:/Rcompile/CRANpkg/extralibs215/local215/include" -Id:/Rcompile/CRANpkg/extralibs215/QuantLib -I../inst/include -I. -Id:/Rcompile/CRANpkg/extralibs/boost -O3 -Wall -mtune=core2 -c hullwhite.cpp -o hullwhite.o g++ -I"D:/RCompile/recent/R/include" -I"d:/RCompile/CRANpkg/lib/3.2/Rcpp/include" -I"d:/Rcompile/CRANpkg/extralibs215/local215/include" -Id:/Rcompile/CRANpkg/extralibs215/QuantLib -I../inst/include -I. -Id:/Rcompile/CRANpkg/extralibs/boost -O3 -Wall -mtune=core2 -c implieds.cpp -o implieds.o g++ -I"D:/RCompile/recent/R/include" -I"d:/RCompile/CRANpkg/lib/3.2/Rcpp/include" -I"d:/Rcompile/CRANpkg/extralibs215/local215/include" -Id:/Rcompile/CRANpkg/extralibs215/QuantLib -I../inst/include -I. -Id:/Rcompile/CRANpkg/extralibs/boost -O3 -Wall -mtune=core2 -c modules.cpp -o modules.o g++ -I"D:/RCompile/recent/R/include" -I"d:/RCompile/CRANpkg/lib/3.2/Rcpp/include" -I"d:/Rcompile/CRANpkg/extralibs215/local215/include" -Id:/Rcompile/CRANpkg/extralibs215/QuantLib -I../inst/include -I. -Id:/Rcompile/CRANpkg/extralibs/boost -O3 -Wall -mtune=core2 -c utils.cpp -o utils.o utils.cpp: In function 'QuantLib::DayCounter getDayCounter(double)': utils.cpp:307:16: error: 'Actual365NoLeap' is not a member of 'QuantLib' utils.cpp:320:1: warning: control reaches end of non-void function [-Wreturn-type] make: *** [utils.o] Error 1 Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From edd at debian.org Thu Oct 16 04:08:16 2014 From: edd at debian.org (Dirk Eddelbuettel) Date: Wed, 15 Oct 2014 21:08:16 -0500 Subject: [Rquantlib-devel] RQuantLib fixed-income update Message-ID: <21567.10384.862359.8363@max.nulle.part> Hi Michele, Some good and bad news. win-builder was indeed misconfigured. Uwe corrected this, we now build. Which promptly lead to a number of errors. Some I just managed to correct: 1) multiple as<>() and wrap() for QuantLib::Date -- probably my error, and accomodated by simply moving this code to src/ -- done 2) OpenMP pragma warnings -- for now avoided by adding OpenMP support to src/Makevars.win (but see below) 3) The long long issue -- probably our error in Rcpp, and unsure. For now accomodated by adding -fpermissive, which allow it to build BUT 4) ERROR in asian option now, which is code we have not touched -- so this /may/ be due to OpenMP. We may be better off explicitly turning OpenMP off on Windows. I suspect there is a #define in QuantLib. To be done. That's all for now. Still HUGE progress overall, so thanks again. BTW you can use the win-builder too, but carefully: change Maintainer: in DESCRIPTION to your email, and you will get the result of the upload. Just don't commit that change :) Cheers, Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From edd at debian.org Tue Oct 28 02:20:55 2014 From: edd at debian.org (Dirk Eddelbuettel) Date: Mon, 27 Oct 2014 20:20:55 -0500 Subject: [Rquantlib-devel] RQuantLib fixed-income update In-Reply-To: <21567.10384.862359.8363@max.nulle.part> References: <21567.10384.862359.8363@max.nulle.part> Message-ID: <21582.61303.300243.573923@max.nulle.part> More good news: src/* is now free of SEXP in function interfaces [1] That should make it much easier to write new code / keep the code closer to plain QuantLib and C++. We're getting closer to 0.4.0. Dirk [1] RcppExports.cpp is obviously an exception, but it is generated. -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From jack.e.drew at icloud.com Tue Oct 28 17:35:26 2014 From: jack.e.drew at icloud.com (Jack Drew) Date: Tue, 28 Oct 2014 11:35:26 -0500 Subject: [Rquantlib-devel] RQuantLib on Mac OS X 10.10 Message-ID: <75C25214-B0BF-4C3D-B650-3F22CBC3B214@icloud.com> Recently, I am trying to create a new RQuantLib setup. I am on mac os x 10.10 and R 3.0.2. I have installed QuantLib 1.4, and RQuantLib. From my terminal, within R, I can require RQuantLib and use it with no problems. However, if I try to require RQuantLib within the R GUI or within my StatET Eclipse, I get: Loading required package: RQuantLib Error : .onLoad failed in loadNamespace() for 'RQuantLib', details: call: if (is.character(qc) && nchar(qc) > 1) { error: missing value where TRUE/FALSE needed In addition: Warning message: running command 'bash -c 'type -p quantlib-config' 2>/dev/null' had status 1 I am not sure what I am missing, since the package works fine from the terminal. Please help, if you are able to. Thank you kindly, Jack From edd at debian.org Tue Oct 28 18:41:18 2014 From: edd at debian.org (Dirk Eddelbuettel) Date: Tue, 28 Oct 2014 12:41:18 -0500 Subject: [Rquantlib-devel] RQuantLib on Mac OS X 10.10 In-Reply-To: <75C25214-B0BF-4C3D-B650-3F22CBC3B214@icloud.com> References: <75C25214-B0BF-4C3D-B650-3F22CBC3B214@icloud.com> Message-ID: <21583.54590.155746.671550@max.nulle.part> On 28 October 2014 at 11:35, Jack Drew wrote: | Recently, I am trying to create a new RQuantLib setup. I am on mac os x 10.10 and R 3.0.2. I have installed QuantLib 1.4, and RQuantLib. From my terminal, within R, I can require RQuantLib and use it with no problems. However, if I try to require RQuantLib within the R GUI or within my StatET Eclipse, I get: | | Loading required package: RQuantLib | Error : .onLoad failed in loadNamespace() for 'RQuantLib', details: | call: if (is.character(qc) && nchar(qc) > 1) { | error: missing value where TRUE/FALSE needed | In addition: Warning message: | running command 'bash -c 'type -p quantlib-config' 2>/dev/null' had status 1 | | I am not sure what I am missing, since the package works fine from the terminal. Please help, if you are able to. So quantlib-config is not found. I don't own (or access) an OS X machine but even I noticed all these hoopla over 10.10 not setting PATH -- that could be the culprit. Google for something like RStudio "OS X" 10.10 PATH and you just get pointers. One trick appears to be to launch RStudio from the term.app. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From bvoigt at gmail.com Tue Oct 28 22:01:53 2014 From: bvoigt at gmail.com (Benjamin J. J. Voigt) Date: Tue, 28 Oct 2014 22:01:53 +0100 Subject: [Rquantlib-devel] RQuantLib on Mac OS X 10.10 In-Reply-To: <21583.54590.155746.671550@max.nulle.part> References: <75C25214-B0BF-4C3D-B650-3F22CBC3B214@icloud.com> <21583.54590.155746.671550@max.nulle.part> Message-ID: Hi, first post, bear with me. On this matter, it works fine on 10.9.x. RStudio seems to have fixed on their end. Since I have recently rebuilt both QuantLib and RQuantLib several times on stable and development sources on my 10.9.x environment just running RQuantLib has never been an issue. As a workaround, perhaps you could try to create a script to launch through the terminal so that the environment variables are loaded properly? Regards, Ben On Tue, Oct 28, 2014 at 6:41 PM, Dirk Eddelbuettel wrote: > > On 28 October 2014 at 11:35, Jack Drew wrote: > | Recently, I am trying to create a new RQuantLib setup. I am on mac os x > 10.10 and R 3.0.2. I have installed QuantLib 1.4, and RQuantLib. From my > terminal, within R, I can require RQuantLib and use it with no problems. > However, if I try to require RQuantLib within the R GUI or within my StatET > Eclipse, I get: > | > | Loading required package: RQuantLib > | Error : .onLoad failed in loadNamespace() for 'RQuantLib', details: > | call: if (is.character(qc) && nchar(qc) > 1) { > | error: missing value where TRUE/FALSE needed > | In addition: Warning message: > | running command 'bash -c 'type -p quantlib-config' 2>/dev/null' had > status 1 > | > | I am not sure what I am missing, since the package works fine from the > terminal. Please help, if you are able to. > > So quantlib-config is not found. > > I don't own (or access) an OS X machine but even I noticed all these hoopla > over 10.10 not setting PATH -- that could be the culprit. Google for > something like > > RStudio "OS X" 10.10 PATH > > and you just get pointers. One trick appears to be to launch RStudio from > the term.app. > > Dirk > > -- > http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org > _______________________________________________ > Rquantlib-devel mailing list > Rquantlib-devel at lists.r-forge.r-project.org > > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rquantlib-devel > -- Ben ?In God we trust, all others bring data.? W. Edwards Deming -------------- next part -------------- An HTML attachment was scrubbed... URL: From bvoigt at gmail.com Wed Oct 29 02:50:49 2014 From: bvoigt at gmail.com (Benjamin J. J. Voigt) Date: Wed, 29 Oct 2014 02:50:49 +0100 Subject: [Rquantlib-devel] Is DiscountCurve() supposed to work? Message-ID: Hi, running the following example (mac 10.9.*) I get a crash, both on stable and github sources. Is there a known reason for this and how do I prevent the error? R-Code: savepar <- par(mfrow = c(3, 3)) params <- list(tradeDate = c(2, 15, 2002), settleDate = c(2, 19, 2002), dt = 0.01, interpWhat = "discount", interpHow = "loglinear") tsQuotes <- list(d1w = 0.0382, d1m = 0.0372, fut1 = 96.2875, fut2 = 96.7875, fut3 = 96.9875, fut4 = 96.6875, fut5 = 96.4875, fut6 = 96.3875, fut7 = 96.2875, fut8 = 96.0875, s3y = 0.0398, s5y = 0.0443, s10y = 0.05165, s15y = 0.055175) times <- seq(0, 10, 0.1) DiscountCurve(params, tsQuotes, times) R-Error: *** caught segfault *** address 0x20, cause 'memory not mapped' Traceback: 1: .Call("RQuantLib_discountCurveEngine", PACKAGE = "RQuantLib", rparams, tslist, times) 2: discountCurveEngine(params, tsQuotes, times) 3: DiscountCurve.default(params, tsQuotes, times) 4: DiscountCurve(params, tsQuotes, times) I am not in a hurry, just might need to think of doing this on my own, but pricing bonds on a flat curve is not quite what regular users would like to do when thinking about QuantLib. Happy to provide more details if required. Regards, Ben -- Ben -------------- next part -------------- An HTML attachment was scrubbed... URL: From edd at debian.org Wed Oct 29 03:32:51 2014 From: edd at debian.org (Dirk Eddelbuettel) Date: Tue, 28 Oct 2014 21:32:51 -0500 Subject: [Rquantlib-devel] Is DiscountCurve() supposed to work? In-Reply-To: References: Message-ID: <21584.20947.465204.327876@max.nulle.part> On 29 October 2014 at 02:50, Benjamin J. J. Voigt wrote: | Hi, | | running the following example (mac 10.9.*) I get a crash, both on stable and | github sources. Is there a known reason for this and how do I prevent the | error? | | R-Code: | savepar <- par(mfrow = c(3, 3)) | | params <- list(tradeDate = c(2, 15, 2002), settleDate = c(2, | ? ? 19, 2002), dt = 0.01, interpWhat = "discount", interpHow = "loglinear") | | tsQuotes <- list(d1w = 0.0382, d1m = 0.0372, fut1 = 96.2875, | ? ? fut2 = 96.7875, fut3 = 96.9875, fut4 = 96.6875, fut5 = 96.4875, | ? ? fut6 = 96.3875, fut7 = 96.2875, fut8 = 96.0875, s3y = 0.0398, | ? ? s5y = 0.0443, s10y = 0.05165, s15y = 0.055175) | | times <- seq(0, 10, 0.1) | | DiscountCurve(params, tsQuotes, times) Can you detail where you got this from / what you changed? Because Gmail insists on inserting garbage into text this is a little tedious for me. When I run your code against current GH sources, I get an error on input: R> params <- list(tradeDate = c(2, 15, 2002), + settleDate = c(2, 19, 2002), + dt = 0.01, + interpWhat = "discount", + interpHow = "loglinear") R> tsQuotes <- list(d1w = 0.0382, d1m = 0.0372, fut1 = 96.2875, + fut2 = 96.7875, fut3 = 96.9875, fut4 = 96.6875, fut5 = 96.4875, + fut6 = 96.3875, fut7 = 96.2875, fut8 = 96.0875, s3y = 0.0398, + s5y = 0.0443, s10y = 0.05165, s15y = 0.055175) R> times <- seq(0, 10, 0.1) R> DiscountCurve(params, tsQuotes, times) Error: expecting a single value R> Now, there was a (very recent) conversation with Luigi (upstream at QL) which we had, as I recall, mostly in an issue ticket at GH. That revealed two sources of trouble: I had the wrong date, and a bad tenor -- removing the s2y point leads to better / stabler results. With that I (finally!!) reenable the discount curve examples. So from current GitHub sources you once again get a meaning 3 x 3 grid of plots. An example is below, this of course does not include the chart (which I could email you...) but you get a hint of the final values of curves via str() below. R> library(RQuantLib) R> example(DiscountCurve) DscntCR> savepar <- par(mfrow=c(3,3), mar=c(4,4,2,0.5)) DscntCR> ## This data is taken from sample code shipped with QuantLib 0.9.7 DscntCR> ## from the file Examples/Swap/swapvaluation DscntCR> params <- list(tradeDate=as.Date('2004-09-20'), DscntC+ settleDate=as.Date('2004-09-22'), DscntC+ dt=.25, DscntC+ interpWhat="discount", DscntC+ interpHow="loglinear") DscntCR> setEvaluationDate(as.Date("2004-09-20")) [1] TRUE DscntCR> ## We get numerical issue for the spline interpolation if we add DscntCR> ## any on of these three extra futures -- the original example DscntCR> ## creates different curves based on different deposit, fra, futures DscntCR> ## and swap data DscntCR> ## Removing s2y helps, as kindly pointed out by Luigi Ballabio DscntCR> tsQuotes <- list(d1w = 0.0382, DscntC+ d1m = 0.0372, DscntC+ d3m = 0.0363, DscntC+ d6m = 0.0353, DscntC+ d9m = 0.0348, DscntC+ d1y = 0.0345, DscntC+ fut1=96.2875, DscntC+ fut2=96.7875, DscntC+ fut3=96.9875, DscntC+ fut4=96.6875, DscntC+ fut5=96.4875, DscntC+ fut6=96.3875, DscntC+ fut7=96.2875, DscntC+ fut8=96.0875, DscntC+ # s2y = 0.037125, DscntC+ s3y = 0.0398, DscntC+ s5y = 0.0443, DscntC+ s10y = 0.05165, DscntC+ s15y = 0.055175) DscntCR> times <- seq(0,10,.1) DscntCR> # Loglinear interpolation of discount factors DscntCR> curves <- DiscountCurve(params, tsQuotes, times) DscntCR> plot(curves,setpar=FALSE) Hit to see next plot: DscntCR> # Linear interpolation of discount factors DscntCR> params$interpHow="linear" DscntCR> curves <- DiscountCurve(params, tsQuotes, times) DscntCR> plot(curves,setpar=FALSE) DscntCR> # Spline interpolation of discount factors DscntCR> params$interpHow="spline" DscntCR> curves <- DiscountCurve(params, tsQuotes, times) DscntCR> plot(curves,setpar=FALSE) DscntCR> par(savepar) R> str(curves) List of 7 $ times : num [1:101] 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 ... $ discounts : num [1:101] 1 0.996 0.993 0.989 0.984 ... $ forwards : num [1:101] 0.0367 0.0404 0.0404 0.0287 0.0275 ... $ zerorates : num [1:101] 0.0392 0.0376 0.0368 0.0379 0.0402 ... $ flatQuotes: logi FALSE $ params :List of 5 ..$ tradeDate : Date[1:1], format: "2004-09-20" ..$ settleDate: Date[1:1], format: "2004-09-22" ..$ dt : num 0.25 ..$ interpWhat: chr "discount" ..$ interpHow : chr "spline" $ table :'data.frame': 5479 obs. of 2 variables: ..$ date : Date[1:5479], format: "2004-09-22" "2004-09-23" "2004-09-24" "2004-09-25" ... ..$ zeroRates: num [1:5479] 0.0392 0.0392 0.0392 0.0392 0.0392 ... - attr(*, "class")= chr "DiscountCurve" R> So very much no segfault here on the default example. | | | R-Error: | ?*** caught segfault *** | address 0x20, cause 'memory not mapped' | | Traceback: | ?1: .Call("RQuantLib_discountCurveEngine", PACKAGE = "RQuantLib", ? ? rparams, | tslist, times) | ?2: discountCurveEngine(params, tsQuotes, times) | ?3: DiscountCurve.default(params, tsQuotes, times) | ?4: DiscountCurve(params, tsQuotes, times) | | | I am not in a hurry, just might need to think of doing this on my own, but | pricing bonds on a flat curve is not quite what regular users would like to do | when thinking about QuantLib. We've just overcome this. RQuantLib is coming together. I did a bunch of work in the summer, then got sidetracked with travel and conferences and getting back to it. Michele helped with two excellent pull requests, and I think we are getting ready for a new release. The testing you are doing here is very welcome. Cheers, Dirk | | Happy to provide more details if required. | | Regards, | Ben | | -- | Ben | _______________________________________________ | Rquantlib-devel mailing list | Rquantlib-devel at lists.r-forge.r-project.org | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rquantlib-devel -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From bvoigt at gmail.com Wed Oct 29 03:36:42 2014 From: bvoigt at gmail.com (Benjamin J. J. Voigt) Date: Wed, 29 Oct 2014 03:36:42 +0100 Subject: [Rquantlib-devel] Error calling QuantLib functions through Rcpp/[[Rcpp::depends(RQuantLib)]] Message-ID: Hello, apologies if this is the wrong place to discuss the matter. The relationship of Rcpp and RQuantLib is not entirely clear to me. From the preceding discussion I believe the issue is rather with RQuantLib then with Rcpp. when trying to access QuantLib functions using Rcpp through the following code it seems to complain about files that are not found. Things work smoothly on the command line (outside R) if I remove the offending lines from the clang++ invocation. This may just be a Mac issue (I have not tried this in a Linux environment yet). The question is: how do I change the clang++ call to exclude the offending directories in the hope that things will work afterwards. Or, alternative, if clang++ runs through on the command line, how do I proceed inside R to use the compiled code? CPP-Code (in file: QuantLibTest.cpp): #include #include using namespace Rcpp; // [[Rcpp::depends(RQuantLib)]] // [[Rcpp::export]] double timesTwo(double x) { QuantLib::Calendar myCal = QuantLib::UnitedKingdom(); QuantLib::Date newYearsEve(31, QuantLib::Dec, 2008); QuantLib::Rate zc3mQuote = x; return zc3mQuote * 2; } R-Command: sourceCpp(?/temp/QuantLibTest.cpp") R-Error: ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/x86_64' ld: warning: directory not found for option '-L/usr/local/lib/x86_64' ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3' ld: library not found for -lgfortran clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [sourceCpp_41769.so] Error 1 clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -DRQuantLib_Plugin -I/opt/local/include -I/opt/local/include -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RQuantLib/include" -fPIC -mtune=core2 -g -O2 -c QuantLibTest.cpp -o QuantLibTest.o clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -L/usr/local/lib -o sourceCpp_41769.so QuantLibTest.o -L/opt/local/lib -L/opt/local/lib -lQuantLib -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/x86_64 -L/usr/local/lib/x86_64 -L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3 -lgfortran -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation Error in sourceCpp(?/temp/QuantLibTest.cpp") : Error 1 occurred building shared library. If I remove the "-L/usr/locale/..." references that throw the warnings above on the command line things run without an issue, if they are not removed the same error occurs as when run inside R. Any ideas are welcome and I am happy to supply additional information. Kind Regards, Ben -- Ben -------------- next part -------------- An HTML attachment was scrubbed... URL: From bvoigt at gmail.com Wed Oct 29 03:52:21 2014 From: bvoigt at gmail.com (Benjamin J. J. Voigt) Date: Wed, 29 Oct 2014 03:52:21 +0100 Subject: [Rquantlib-devel] Is DiscountCurve() supposed to work? In-Reply-To: <21584.20947.465204.327876@max.nulle.part> References: <21584.20947.465204.327876@max.nulle.part> Message-ID: Hi, the code is take from here: http://stackoverflow.com/questions/22226195/discountcurve-example-not-working-on-rquantlib and I ran with recent (2h old as per time of writing) GH. It results in a segfault all the time no matter wether its in RStudio, command line R or the Mac R GUI. But, the good thing is, the example(DiscountCurve) on the GH sources worked. So I will look at that code instead. Thank you! Regards, Ben P.S.: Happy to test some more, but do you rather take findings on the list or as tickets? On Wed, Oct 29, 2014 at 3:32 AM, Dirk Eddelbuettel wrote: > > On 29 October 2014 at 02:50, Benjamin J. J. Voigt wrote: > | Hi, > | > | running the following example (mac 10.9.*) I get a crash, both on stable > and > | github sources. Is there a known reason for this and how do I prevent the > | error? > | > | R-Code: > | savepar <- par(mfrow = c(3, 3)) > | > | params <- list(tradeDate = c(2, 15, 2002), settleDate = c(2, > | 19, 2002), dt = 0.01, interpWhat = "discount", interpHow = > "loglinear") > | > | tsQuotes <- list(d1w = 0.0382, d1m = 0.0372, fut1 = 96.2875, > | fut2 = 96.7875, fut3 = 96.9875, fut4 = 96.6875, fut5 = 96.4875, > | fut6 = 96.3875, fut7 = 96.2875, fut8 = 96.0875, s3y = 0.0398, > | s5y = 0.0443, s10y = 0.05165, s15y = 0.055175) > | > | times <- seq(0, 10, 0.1) > | > | DiscountCurve(params, tsQuotes, times) > > Can you detail where you got this from / what you changed? Because Gmail > insists on inserting garbage into text this is a little tedious for me. > > When I run your code against current GH sources, I get an error on input: > R> params <- list(tradeDate = c(2, 15, 2002), > + settleDate = c(2, 19, 2002), > + dt = 0.01, > + interpWhat = "discount", > + interpHow = "loglinear") > R> tsQuotes <- list(d1w = 0.0382, d1m = 0.0372, fut1 = 96.2875, > + fut2 = 96.7875, fut3 = 96.9875, fut4 = 96.6875, fut5 = > 96.4875, > + fut6 = 96.3875, fut7 = 96.2875, fut8 = 96.0875, s3y = > 0.0398, > + s5y = 0.0443, s10y = 0.05165, s15y = 0.055175) > R> times <- seq(0, 10, 0.1) > R> DiscountCurve(params, tsQuotes, times) > Error: expecting a single value > R> > > > Now, there was a (very recent) conversation with Luigi (upstream at QL) > which > we had, as I recall, mostly in an issue ticket at GH. That revealed two > sources of trouble: I had the wrong date, and a bad tenor -- removing the > s2y > point leads to better / stabler results. > > With that I (finally!!) reenable the discount curve examples. So from > current > GitHub sources you once again get a meaning 3 x 3 grid of plots. An example > is below, this of course does not include the chart (which I could email > you...) but you get a hint of the final values of curves via str() below. > > R> library(RQuantLib) > R> example(DiscountCurve) > > DscntCR> savepar <- par(mfrow=c(3,3), mar=c(4,4,2,0.5)) > > DscntCR> ## This data is taken from sample code shipped with QuantLib 0.9.7 > DscntCR> ## from the file Examples/Swap/swapvaluation > DscntCR> params <- list(tradeDate=as.Date('2004-09-20'), > DscntC+ settleDate=as.Date('2004-09-22'), > DscntC+ dt=.25, > DscntC+ interpWhat="discount", > DscntC+ interpHow="loglinear") > > DscntCR> setEvaluationDate(as.Date("2004-09-20")) > [1] TRUE > > DscntCR> ## We get numerical issue for the spline interpolation if we add > DscntCR> ## any on of these three extra futures -- the original example > DscntCR> ## creates different curves based on different deposit, fra, > futures > DscntCR> ## and swap data > DscntCR> ## Removing s2y helps, as kindly pointed out by Luigi Ballabio > DscntCR> tsQuotes <- list(d1w = 0.0382, > DscntC+ d1m = 0.0372, > DscntC+ d3m = 0.0363, > DscntC+ d6m = 0.0353, > DscntC+ d9m = 0.0348, > DscntC+ d1y = 0.0345, > DscntC+ fut1=96.2875, > DscntC+ fut2=96.7875, > DscntC+ fut3=96.9875, > DscntC+ fut4=96.6875, > DscntC+ fut5=96.4875, > DscntC+ fut6=96.3875, > DscntC+ fut7=96.2875, > DscntC+ fut8=96.0875, > DscntC+ # s2y = 0.037125, > DscntC+ s3y = 0.0398, > DscntC+ s5y = 0.0443, > DscntC+ s10y = 0.05165, > DscntC+ s15y = 0.055175) > > DscntCR> times <- seq(0,10,.1) > > DscntCR> # Loglinear interpolation of discount factors > DscntCR> curves <- DiscountCurve(params, tsQuotes, times) > > DscntCR> plot(curves,setpar=FALSE) > Hit to see next plot: > > DscntCR> # Linear interpolation of discount factors > DscntCR> params$interpHow="linear" > > DscntCR> curves <- DiscountCurve(params, tsQuotes, times) > > DscntCR> plot(curves,setpar=FALSE) > > DscntCR> # Spline interpolation of discount factors > DscntCR> params$interpHow="spline" > > DscntCR> curves <- DiscountCurve(params, tsQuotes, times) > > DscntCR> plot(curves,setpar=FALSE) > > DscntCR> par(savepar) > R> str(curves) > List of 7 > $ times : num [1:101] 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 ... > $ discounts : num [1:101] 1 0.996 0.993 0.989 0.984 ... > $ forwards : num [1:101] 0.0367 0.0404 0.0404 0.0287 0.0275 ... > $ zerorates : num [1:101] 0.0392 0.0376 0.0368 0.0379 0.0402 ... > $ flatQuotes: logi FALSE > $ params :List of 5 > ..$ tradeDate : Date[1:1], format: "2004-09-20" > ..$ settleDate: Date[1:1], format: "2004-09-22" > ..$ dt : num 0.25 > ..$ interpWhat: chr "discount" > ..$ interpHow : chr "spline" > $ table :'data.frame': 5479 obs. of 2 variables: > ..$ date : Date[1:5479], format: "2004-09-22" "2004-09-23" > "2004-09-24" "2004-09-25" ... > ..$ zeroRates: num [1:5479] 0.0392 0.0392 0.0392 0.0392 0.0392 ... > - attr(*, "class")= chr "DiscountCurve" > R> > > > So very much no segfault here on the default example. > > > | > | > | R-Error: > | *** caught segfault *** > | address 0x20, cause 'memory not mapped' > | > | Traceback: > | 1: .Call("RQuantLib_discountCurveEngine", PACKAGE = "RQuantLib", > rparams, > | tslist, times) > | 2: discountCurveEngine(params, tsQuotes, times) > | 3: DiscountCurve.default(params, tsQuotes, times) > | 4: DiscountCurve(params, tsQuotes, times) > | > | > | I am not in a hurry, just might need to think of doing this on my own, > but > | pricing bonds on a flat curve is not quite what regular users would like > to do > | when thinking about QuantLib. > > We've just overcome this. > > RQuantLib is coming together. I did a bunch of work in the summer, then got > sidetracked with travel and conferences and getting back to it. Michele > helped with two excellent pull requests, and I think we are getting ready > for > a new release. The testing you are doing here is very welcome. > > Cheers, Dirk > > | > | Happy to provide more details if required. > | > | Regards, > | Ben > | > | -- > | Ben > | _______________________________________________ > | Rquantlib-devel mailing list > | Rquantlib-devel at lists.r-forge.r-project.org > | > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rquantlib-devel > > -- > http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org > -- Ben -------------- next part -------------- An HTML attachment was scrubbed... URL: From edd at debian.org Wed Oct 29 04:09:44 2014 From: edd at debian.org (Dirk Eddelbuettel) Date: Tue, 28 Oct 2014 22:09:44 -0500 Subject: [Rquantlib-devel] Error calling QuantLib functions through Rcpp/[[Rcpp::depends(RQuantLib)]] In-Reply-To: References: Message-ID: <21584.23160.313692.776617@max.nulle.part> On 29 October 2014 at 03:36, Benjamin J. J. Voigt wrote: | Hello, | | apologies if this is the wrong place to discuss the matter. The relationship of It is very much the place! | Rcpp and RQuantLib is not entirely clear to me. From the preceding discussion I | believe the issue is rather with RQuantLib then with Rcpp. | | when trying to access QuantLib functions using Rcpp through the following code | it seems to complain about files that are not found. Things work smoothly on | the command line (outside R) if I remove the offending lines from the clang++ | invocation. This may just be a Mac issue (I have not tried this in a Linux | environment yet). Maybe. I don't have access to an OS X machine. It works for me; and I am sure we can work out where OS X gets hung up. | The question is: how do I change the clang++ call to exclude the offending | directories in the hope that things will work afterwards. Or, alternative, if | clang++ runs through on the command line, how do I proceed inside R to use the | compiled code? | | CPP-Code (in file: QuantLibTest.cpp): | #include | #include ? | | using namespace Rcpp; | | // [[Rcpp::depends(RQuantLib)]] | | // [[Rcpp::export]] | double timesTwo(double x) { | ? QuantLib::Calendar myCal = QuantLib::UnitedKingdom(); | ? QuantLib::Date newYearsEve(31, QuantLib::Dec, 2008); | ? QuantLib::Rate zc3mQuote = x; | ? return zc3mQuote * 2; | } | | | R-Command: | sourceCpp(?/temp/QuantLibTest.cpp") | | | R-Error: | ld: warning: directory not found for option '-L/usr/local/lib/gcc/ | i686-apple-darwin8/4.2.3/x86_64' | ld: warning: directory not found for option '-L/usr/local/lib/x86_64' | ld: warning: directory not found for option '-L/usr/local/lib/gcc/ | i686-apple-darwin8/4.2.3' | ld: library not found for -lgfortran That smells like the old pre-Mavericks XCode / post-Mavericks XCode to me, but I may be wrong. Can you otherwise build via 'R CMD INSTALL ...' and friends? Does Rcpp pass its "minimally sufficient test", eg doing evalCpp("2 + 2") ? | clang: error: linker command failed with exit code 1 (use -v to see invocation) | make: *** [sourceCpp_41769.so] Error 1 | clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG | -DRQuantLib_Plugin -I/opt/local/include -I/opt/local/include ?-I/usr/local/ | include ?-I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp | /include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/ | RQuantLib/include" ? ?-fPIC ?-mtune=core2 -g -O2 ?-c QuantLibTest.cpp -o | QuantLibTest.o | clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup | -single_module -multiply_defined suppress -L/usr/local/lib -L/usr/local/lib -o | sourceCpp_41769.so QuantLibTest.o -L/opt/local/lib -L/opt/local/lib -lQuantLib | -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks | /R.framework/Resources/lib -lRblas -L/usr/local/lib/gcc/i686-apple-darwin8/ | 4.2.3/x86_64 -L/usr/local/lib/x86_64 -L/usr/local/lib/gcc/i686-apple-darwin8/ | 4.2.3 -lgfortran -F/Library/Frameworks/R.framework/.. -framework R | -Wl,-framework -Wl,CoreFoundation | Error in sourceCpp(?/temp/QuantLibTest.cpp") :? | ? Error 1 occurred building shared library. | | If I remove the "-L/usr/locale/..." references that throw the warnings above on | the command line things run without an issue, if they are not removed the same | error occurs as when run inside R. | | Any ideas are welcome and I am happy to supply additional information. I am sort of in the middle of this, but we know where each the pieces comes from. R gets a few from its Makeconf -- defined and written when it is build. Others come from our package. We have control over this and can fix it. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From edd at debian.org Wed Oct 29 04:12:44 2014 From: edd at debian.org (Dirk Eddelbuettel) Date: Tue, 28 Oct 2014 22:12:44 -0500 Subject: [Rquantlib-devel] Is DiscountCurve() supposed to work? In-Reply-To: References: <21584.20947.465204.327876@max.nulle.part> Message-ID: <21584.23340.352920.948935@max.nulle.part> On 29 October 2014 at 03:52, Benjamin J. J. Voigt wrote: | Hi, | | the code is take from here:?http://stackoverflow.com/questions/22226195/ | discountcurve-example-not-working-on-rquantlib? | and I ran with recent (2h old as per time of writing) GH. It results in a | segfault all the time no matter wether its in RStudio, command line R or the | Mac R GUI. Ok. I am in the middle of something else so I can help you with this ... | But, the good thing is, the example(DiscountCurve) on the GH sources worked. So | I will look at that code instead. Thank you! ... that is exactly what I would do. My first instinct always is to a) get something in 'pure' QuantLib working and b) once that is done add the Rcpp/RQuantLib layer. By separating the two steps I find it easier to make progress. | Regards, | Ben | | P.S.: Happy to test some more, but do you rather take findings on the list or | as tickets? I am old school and tend to favour the list, but I am also getting used to having to respond to issue tickets at GH. Most folks seem to prefer the latter. I guess overall I don;t have a strong preference either. More important to get progress on code... Dirk | | On Wed, Oct 29, 2014 at 3:32 AM, Dirk Eddelbuettel wrote: | | | On 29 October 2014 at 02:50, Benjamin J. J. Voigt wrote: | | Hi, | | | | running the following example (mac 10.9.*) I get a crash, both on stable | and | | github sources. Is there a known reason for this and how do I prevent the | | error? | | | | R-Code: | | savepar <- par(mfrow = c(3, 3)) | | | | params <- list(tradeDate = c(2, 15, 2002), settleDate = c(2, | | ? ? 19, 2002), dt = 0.01, interpWhat = "discount", interpHow = | "loglinear") | | | | tsQuotes <- list(d1w = 0.0382, d1m = 0.0372, fut1 = 96.2875, | | ? ? fut2 = 96.7875, fut3 = 96.9875, fut4 = 96.6875, fut5 = 96.4875, | | ? ? fut6 = 96.3875, fut7 = 96.2875, fut8 = 96.0875, s3y = 0.0398, | | ? ? s5y = 0.0443, s10y = 0.05165, s15y = 0.055175) | | | | times <- seq(0, 10, 0.1) | | | | DiscountCurve(params, tsQuotes, times) | | Can you detail where you got this from / what you changed?? Because Gmail | insists on inserting garbage into text this is a little tedious for me. | | When I run your code against current GH sources, I get an error on input: | R> params <- list(tradeDate = c(2, 15, 2002), | +? ? ? ? ? ? ? ? settleDate = c(2, 19, 2002), | +? ? ? ? ? ? ? ? dt = 0.01, | +? ? ? ? ? ? ? ? interpWhat = "discount", | +? ? ? ? ? ? ? ? interpHow = "loglinear") | R> tsQuotes <- list(d1w = 0.0382, d1m = 0.0372, fut1 = 96.2875, | +? ? ? ? ? ? ? ? ? fut2 = 96.7875, fut3 = 96.9875, fut4 = 96.6875, fut5 = | 96.4875, | +? ? ? ? ? ? ? ? ? fut6 = 96.3875, fut7 = 96.2875, fut8 = 96.0875, s3y = | 0.0398, | +? ? ? ? ? ? ? ? ? s5y = 0.0443, s10y = 0.05165, s15y = 0.055175) | R> times <- seq(0, 10, 0.1) | R> DiscountCurve(params, tsQuotes, times) | Error: expecting a single value | R> | | | Now, there was a (very recent) conversation with Luigi (upstream at QL) | which | we had, as I recall, mostly in an issue ticket at GH.? That revealed two | sources of trouble: I had the wrong date, and a bad tenor -- removing the | s2y | point leads to better / stabler results. | | With that I (finally!!) reenable the discount curve examples. So from | current | GitHub sources you once again get a meaning 3 x 3 grid of plots. An example | is below, this of course does not include the chart (which I could email | you...) but you get a hint of the final values of curves via str() below. | | R> library(RQuantLib) | R> example(DiscountCurve) | | DscntCR> savepar <- par(mfrow=c(3,3), mar=c(4,4,2,0.5)) | | DscntCR> ## This data is taken from sample code shipped with QuantLib 0.9.7 | DscntCR> ## from the file Examples/Swap/swapvaluation | DscntCR> params <- list(tradeDate=as.Date('2004-09-20'), | DscntC+? ? ? ? ? ? ? ? settleDate=as.Date('2004-09-22'), | DscntC+? ? ? ? ? ? ? ? dt=.25, | DscntC+? ? ? ? ? ? ? ? interpWhat="discount", | DscntC+? ? ? ? ? ? ? ? interpHow="loglinear") | | DscntCR> setEvaluationDate(as.Date("2004-09-20")) | [1] TRUE | | DscntCR> ## We get numerical issue for the spline interpolation if we add | DscntCR> ## any on of these three extra futures -- the original example | DscntCR> ## creates different curves based on different deposit, fra, | futures | DscntCR> ## and swap data | DscntCR> ## Removing s2y helps, as kindly pointed out by Luigi Ballabio | DscntCR> tsQuotes <- list(d1w = 0.0382, | DscntC+? ? ? ? ? ? ? ? ? d1m = 0.0372, | DscntC+? ? ? ? ? ? ? ? ? d3m = 0.0363, | DscntC+? ? ? ? ? ? ? ? ? d6m = 0.0353, | DscntC+? ? ? ? ? ? ? ? ? d9m = 0.0348, | DscntC+? ? ? ? ? ? ? ? ? d1y = 0.0345, | DscntC+? ? ? ? ? ? ? ? ? fut1=96.2875, | DscntC+? ? ? ? ? ? ? ? ? fut2=96.7875, | DscntC+? ? ? ? ? ? ? ? ? fut3=96.9875, | DscntC+? ? ? ? ? ? ? ? ? fut4=96.6875, | DscntC+? ? ? ? ? ? ? ? ? fut5=96.4875, | DscntC+? ? ? ? ? ? ? ? ? fut6=96.3875, | DscntC+? ? ? ? ? ? ? ? ? fut7=96.2875, | DscntC+? ? ? ? ? ? ? ? ? fut8=96.0875, | DscntC+ #? ? ? ? ? ? ? ? ?s2y = 0.037125, | DscntC+? ? ? ? ? ? ? ? ? s3y = 0.0398, | DscntC+? ? ? ? ? ? ? ? ? s5y = 0.0443, | DscntC+? ? ? ? ? ? ? ? ? s10y = 0.05165, | DscntC+? ? ? ? ? ? ? ? ? s15y = 0.055175) | | DscntCR> times <- seq(0,10,.1) | | DscntCR> # Loglinear interpolation of discount factors | DscntCR> curves <- DiscountCurve(params, tsQuotes, times) | | DscntCR> plot(curves,setpar=FALSE) | Hit to see next plot: | | DscntCR> # Linear interpolation of discount factors | DscntCR> params$interpHow="linear" | | DscntCR> curves <- DiscountCurve(params, tsQuotes, times) | | DscntCR> plot(curves,setpar=FALSE) | | DscntCR> # Spline interpolation of discount factors | DscntCR> params$interpHow="spline" | | DscntCR> curves <- DiscountCurve(params, tsQuotes, times) | | DscntCR> plot(curves,setpar=FALSE) | | DscntCR> par(savepar) | R> str(curves) | List of 7 | ?$ times? ? ?: num [1:101] 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 ... | ?$ discounts : num [1:101] 1 0.996 0.993 0.989 0.984 ... | ?$ forwards? : num [1:101] 0.0367 0.0404 0.0404 0.0287 0.0275 ... | ?$ zerorates : num [1:101] 0.0392 0.0376 0.0368 0.0379 0.0402 ... | ?$ flatQuotes: logi FALSE | ?$ params? ? :List of 5 | ? ..$ tradeDate : Date[1:1], format: "2004-09-20" | ? ..$ settleDate: Date[1:1], format: "2004-09-22" | ? ..$ dt? ? ? ? : num 0.25 | ? ..$ interpWhat: chr "discount" | ? ..$ interpHow : chr "spline" | ?$ table? ? ?:'data.frame':? ? ?5479 obs. of? 2 variables: | ? ..$ date? ? ?: Date[1:5479], format: "2004-09-22" "2004-09-23" | "2004-09-24" "2004-09-25" ... | ? ..$ zeroRates: num [1:5479] 0.0392 0.0392 0.0392 0.0392 0.0392 ... | ?- attr(*, "class")= chr "DiscountCurve" | R> | | | So very much no segfault here on the default example. | | | | | | | | R-Error: | | ?*** caught segfault *** | | address 0x20, cause 'memory not mapped' | | | | Traceback: | | ?1: .Call("RQuantLib_discountCurveEngine", PACKAGE = "RQuantLib", ? ? | rparams, | | tslist, times) | | ?2: discountCurveEngine(params, tsQuotes, times) | | ?3: DiscountCurve.default(params, tsQuotes, times) | | ?4: DiscountCurve(params, tsQuotes, times) | | | | | | I am not in a hurry, just might need to think of doing this on my own, | but | | pricing bonds on a flat curve is not quite what regular users would like | to do | | when thinking about QuantLib. | | We've just overcome this. | | RQuantLib is coming together. I did a bunch of work in the summer, then got | sidetracked with travel and conferences and getting back to it. Michele | helped with two excellent pull requests, and I think we are getting ready | for | a new release.? The testing you are doing here is very welcome. | | Cheers, Dirk | | | | | Happy to provide more details if required. | | | | Regards, | | Ben | | | | -- | | Ben | | _______________________________________________ | | Rquantlib-devel mailing list | | Rquantlib-devel at lists.r-forge.r-project.org | | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/ | rquantlib-devel | | -- | http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org | | | | | -- | Ben -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From bvoigt at gmail.com Wed Oct 29 15:22:02 2014 From: bvoigt at gmail.com (Benjamin J. J. Voigt) Date: Wed, 29 Oct 2014 15:22:02 +0100 Subject: [Rquantlib-devel] Is DiscountCurve() supposed to work? In-Reply-To: <21584.23340.352920.948935@max.nulle.part> References: <21584.20947.465204.327876@max.nulle.part> <21584.23340.352920.948935@max.nulle.part> Message-ID: I have tried a few things on the segmentation fault. It's a little hard to understand what is really going on because I am not shown much information about where the error occurred. So far I have identified a few conditions when things apparently do cause an error: 1. No call to setEvaluationDate() supplied 2. The setEvaluationDate() date is not exactly the same date as the trade date 3. The tradeDate, and therefore the setEvaluationDate(), are set to a non-business day 4. The times argument goes right up to the time for which rates are provided e.g., a 15y swap rate is provided and times is defined as seq(0,15,0.1). It seems a save way to do this is to provide _at least_ one more rate beyond the times interval, i.e., seq(0,14,0.1) with a 15y swap rate defined I am catching these conditions now. Regards, Ben On Wed, Oct 29, 2014 at 4:12 AM, Dirk Eddelbuettel wrote: > > On 29 October 2014 at 03:52, Benjamin J. J. Voigt wrote: > | Hi, > | > | the code is take from here: http://stackoverflow.com/questions/22226195/ > | discountcurve-example-not-working-on-rquantlib > | and I ran with recent (2h old as per time of writing) GH. It results in a > | segfault all the time no matter wether its in RStudio, command line R or > the > | Mac R GUI. > > Ok. I am in the middle of something else so I can help you with this ... > > | But, the good thing is, the example(DiscountCurve) on the GH sources > worked. So > | I will look at that code instead. Thank you! > > ... that is exactly what I would do. > > My first instinct always is to a) get something in 'pure' QuantLib working > and b) once that is done add the Rcpp/RQuantLib layer. By separating the > two > steps I find it easier to make progress. > > | Regards, > | Ben > | > | P.S.: Happy to test some more, but do you rather take findings on the > list or > | as tickets? > > I am old school and tend to favour the list, but I am also getting used to > having to respond to issue tickets at GH. Most folks seem to prefer the > latter. I guess overall I don;t have a strong preference either. More > important to get progress on code... > > Dirk > > > | > | On Wed, Oct 29, 2014 at 3:32 AM, Dirk Eddelbuettel > wrote: > | > | > | On 29 October 2014 at 02:50, Benjamin J. J. Voigt wrote: > | | Hi, > | | > | | running the following example (mac 10.9.*) I get a crash, both on > stable > | and > | | github sources. Is there a known reason for this and how do I > prevent the > | | error? > | | > | | R-Code: > | | savepar <- par(mfrow = c(3, 3)) > | | > | | params <- list(tradeDate = c(2, 15, 2002), settleDate = c(2, > | | 19, 2002), dt = 0.01, interpWhat = "discount", interpHow = > | "loglinear") > | | > | | tsQuotes <- list(d1w = 0.0382, d1m = 0.0372, fut1 = 96.2875, > | | fut2 = 96.7875, fut3 = 96.9875, fut4 = 96.6875, fut5 = 96.4875, > | | fut6 = 96.3875, fut7 = 96.2875, fut8 = 96.0875, s3y = 0.0398, > | | s5y = 0.0443, s10y = 0.05165, s15y = 0.055175) > | | > | | times <- seq(0, 10, 0.1) > | | > | | DiscountCurve(params, tsQuotes, times) > | > | Can you detail where you got this from / what you changed? Because > Gmail > | insists on inserting garbage into text this is a little tedious for > me. > | > | When I run your code against current GH sources, I get an error on > input: > | R> params <- list(tradeDate = c(2, 15, 2002), > | + settleDate = c(2, 19, 2002), > | + dt = 0.01, > | + interpWhat = "discount", > | + interpHow = "loglinear") > | R> tsQuotes <- list(d1w = 0.0382, d1m = 0.0372, fut1 = 96.2875, > | + fut2 = 96.7875, fut3 = 96.9875, fut4 = 96.6875, > fut5 = > | 96.4875, > | + fut6 = 96.3875, fut7 = 96.2875, fut8 = 96.0875, > s3y = > | 0.0398, > | + s5y = 0.0443, s10y = 0.05165, s15y = 0.055175) > | R> times <- seq(0, 10, 0.1) > | R> DiscountCurve(params, tsQuotes, times) > | Error: expecting a single value > | R> > | > | > | Now, there was a (very recent) conversation with Luigi (upstream at > QL) > | which > | we had, as I recall, mostly in an issue ticket at GH. That revealed > two > | sources of trouble: I had the wrong date, and a bad tenor -- > removing the > | s2y > | point leads to better / stabler results. > | > | With that I (finally!!) reenable the discount curve examples. So from > | current > | GitHub sources you once again get a meaning 3 x 3 grid of plots. An > example > | is below, this of course does not include the chart (which I could > email > | you...) but you get a hint of the final values of curves via str() > below. > | > | R> library(RQuantLib) > | R> example(DiscountCurve) > | > | DscntCR> savepar <- par(mfrow=c(3,3), mar=c(4,4,2,0.5)) > | > | DscntCR> ## This data is taken from sample code shipped with > QuantLib 0.9.7 > | DscntCR> ## from the file Examples/Swap/swapvaluation > | DscntCR> params <- list(tradeDate=as.Date('2004-09-20'), > | DscntC+ settleDate=as.Date('2004-09-22'), > | DscntC+ dt=.25, > | DscntC+ interpWhat="discount", > | DscntC+ interpHow="loglinear") > | > | DscntCR> setEvaluationDate(as.Date("2004-09-20")) > | [1] TRUE > | > | DscntCR> ## We get numerical issue for the spline interpolation if > we add > | DscntCR> ## any on of these three extra futures -- the original > example > | DscntCR> ## creates different curves based on different deposit, fra, > | futures > | DscntCR> ## and swap data > | DscntCR> ## Removing s2y helps, as kindly pointed out by Luigi > Ballabio > | DscntCR> tsQuotes <- list(d1w = 0.0382, > | DscntC+ d1m = 0.0372, > | DscntC+ d3m = 0.0363, > | DscntC+ d6m = 0.0353, > | DscntC+ d9m = 0.0348, > | DscntC+ d1y = 0.0345, > | DscntC+ fut1=96.2875, > | DscntC+ fut2=96.7875, > | DscntC+ fut3=96.9875, > | DscntC+ fut4=96.6875, > | DscntC+ fut5=96.4875, > | DscntC+ fut6=96.3875, > | DscntC+ fut7=96.2875, > | DscntC+ fut8=96.0875, > | DscntC+ # s2y = 0.037125, > | DscntC+ s3y = 0.0398, > | DscntC+ s5y = 0.0443, > | DscntC+ s10y = 0.05165, > | DscntC+ s15y = 0.055175) > | > | DscntCR> times <- seq(0,10,.1) > | > | DscntCR> # Loglinear interpolation of discount factors > | DscntCR> curves <- DiscountCurve(params, tsQuotes, times) > | > | DscntCR> plot(curves,setpar=FALSE) > | Hit to see next plot: > | > | DscntCR> # Linear interpolation of discount factors > | DscntCR> params$interpHow="linear" > | > | DscntCR> curves <- DiscountCurve(params, tsQuotes, times) > | > | DscntCR> plot(curves,setpar=FALSE) > | > | DscntCR> # Spline interpolation of discount factors > | DscntCR> params$interpHow="spline" > | > | DscntCR> curves <- DiscountCurve(params, tsQuotes, times) > | > | DscntCR> plot(curves,setpar=FALSE) > | > | DscntCR> par(savepar) > | R> str(curves) > | List of 7 > | $ times : num [1:101] 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 ... > | $ discounts : num [1:101] 1 0.996 0.993 0.989 0.984 ... > | $ forwards : num [1:101] 0.0367 0.0404 0.0404 0.0287 0.0275 ... > | $ zerorates : num [1:101] 0.0392 0.0376 0.0368 0.0379 0.0402 ... > | $ flatQuotes: logi FALSE > | $ params :List of 5 > | ..$ tradeDate : Date[1:1], format: "2004-09-20" > | ..$ settleDate: Date[1:1], format: "2004-09-22" > | ..$ dt : num 0.25 > | ..$ interpWhat: chr "discount" > | ..$ interpHow : chr "spline" > | $ table :'data.frame': 5479 obs. of 2 variables: > | ..$ date : Date[1:5479], format: "2004-09-22" "2004-09-23" > | "2004-09-24" "2004-09-25" ... > | ..$ zeroRates: num [1:5479] 0.0392 0.0392 0.0392 0.0392 0.0392 ... > | - attr(*, "class")= chr "DiscountCurve" > | R> > | > | > | So very much no segfault here on the default example. > | > | > | | > | | > | | R-Error: > | | *** caught segfault *** > | | address 0x20, cause 'memory not mapped' > | | > | | Traceback: > | | 1: .Call("RQuantLib_discountCurveEngine", PACKAGE = "RQuantLib", > > | rparams, > | | tslist, times) > | | 2: discountCurveEngine(params, tsQuotes, times) > | | 3: DiscountCurve.default(params, tsQuotes, times) > | | 4: DiscountCurve(params, tsQuotes, times) > | | > | | > | | I am not in a hurry, just might need to think of doing this on my > own, > | but > | | pricing bonds on a flat curve is not quite what regular users > would like > | to do > | | when thinking about QuantLib. > | > | We've just overcome this. > | > | RQuantLib is coming together. I did a bunch of work in the summer, > then got > | sidetracked with travel and conferences and getting back to it. > Michele > | helped with two excellent pull requests, and I think we are getting > ready > | for > | a new release. The testing you are doing here is very welcome. > | > | Cheers, Dirk > | > | | > | | Happy to provide more details if required. > | | > | | Regards, > | | Ben > | | > | | -- > | | Ben > | | _______________________________________________ > | | Rquantlib-devel mailing list > | | Rquantlib-devel at lists.r-forge.r-project.org > | | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/ > | rquantlib-devel > | > | -- > | http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org > | > | > | > | > | -- > | Ben > > -- > http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: From edd at debian.org Wed Oct 29 15:49:19 2014 From: edd at debian.org (Dirk Eddelbuettel) Date: Wed, 29 Oct 2014 09:49:19 -0500 Subject: [Rquantlib-devel] Is DiscountCurve() supposed to work? In-Reply-To: References: <21584.20947.465204.327876@max.nulle.part> <21584.23340.352920.948935@max.nulle.part> Message-ID: <21584.65135.214848.970858@max.nulle.part> On 29 October 2014 at 15:22, Benjamin J. J. Voigt wrote: | I have tried a few things on the segmentation fault.? | | It's a little hard to understand what is really going on because I am not shown | much information about where the error occurred. So far I have identified a few | conditions when things apparently do cause an error: | 1. No call to setEvaluationDate() supplied? | 2. The setEvaluationDate() date is not exactly the same date as the trade date | 3. The tradeDate, and therefore the setEvaluationDate(), are set to a | non-business day | 4. The times argument goes right up to the time for which rates are provided | e.g., a 15y swap rate is provided and times is defined as seq(0,15,0.1). It | seems a save way to do this is to provide _at least_ one more rate beyond the | times interval, i.e., seq(0,14,0.1) with a 15y swap rate defined Excellent work. | I am catching these conditions now. Yes, we surely need to in the R interface, and for the more fundamental questions of what is computed we can go to the quantlib-dev list. This is really exciting. With your help, and Michele's help, we are now finally overhauling the fixed income parts. This was overdue. Dirk | Regards, | Ben | | On Wed, Oct 29, 2014 at 4:12 AM, Dirk Eddelbuettel wrote: | | | On 29 October 2014 at 03:52, Benjamin J. J. Voigt wrote: | | Hi, | | | | the code is take from here:?http://stackoverflow.com/questions/22226195/ | | discountcurve-example-not-working-on-rquantlib? | | and I ran with recent (2h old as per time of writing) GH. It results in a | | segfault all the time no matter wether its in RStudio, command line R or | the | | Mac R GUI. | | Ok. I am in the middle of something else so I can help you with this ... | | | But, the good thing is, the example(DiscountCurve) on the GH sources | worked. So | | I will look at that code instead. Thank you! | | ... that is exactly what I would do. | | My first instinct always is to a) get something in 'pure' QuantLib working | and b) once that is done add the Rcpp/RQuantLib layer.? By separating the | two | steps I find it easier to make progress. | | | Regards, | | Ben | | | | P.S.: Happy to test some more, but do you rather take findings on the | list or | | as tickets? | | I am old school and tend to favour the list, but I am also getting used to | having to respond to issue tickets at GH.? Most folks seem to prefer the | latter. I guess overall I don;t have a strong preference either.? More | important to get progress on code... | | Dirk | | | | | | On Wed, Oct 29, 2014 at 3:32 AM, Dirk Eddelbuettel | wrote: | | | | | |? ? ?On 29 October 2014 at 02:50, Benjamin J. J. Voigt wrote: | |? ? ?| Hi, | |? ? ?| | |? ? ?| running the following example (mac 10.9.*) I get a crash, both on | stable | |? ? ?and | |? ? ?| github sources. Is there a known reason for this and how do I | prevent the | |? ? ?| error? | |? ? ?| | |? ? ?| R-Code: | |? ? ?| savepar <- par(mfrow = c(3, 3)) | |? ? ?| | |? ? ?| params <- list(tradeDate = c(2, 15, 2002), settleDate = c(2, | |? ? ?| ? ? 19, 2002), dt = 0.01, interpWhat = "discount", interpHow = | |? ? ?"loglinear") | |? ? ?| | |? ? ?| tsQuotes <- list(d1w = 0.0382, d1m = 0.0372, fut1 = 96.2875, | |? ? ?| ? ? fut2 = 96.7875, fut3 = 96.9875, fut4 = 96.6875, fut5 = 96.4875, | |? ? ?| ? ? fut6 = 96.3875, fut7 = 96.2875, fut8 = 96.0875, s3y = 0.0398, | |? ? ?| ? ? s5y = 0.0443, s10y = 0.05165, s15y = 0.055175) | |? ? ?| | |? ? ?| times <- seq(0, 10, 0.1) | |? ? ?| | |? ? ?| DiscountCurve(params, tsQuotes, times) | | | |? ? ?Can you detail where you got this from / what you changed?? Because | Gmail | |? ? ?insists on inserting garbage into text this is a little tedious for | me. | | | |? ? ?When I run your code against current GH sources, I get an error on | input: | |? ? ?R> params <- list(tradeDate = c(2, 15, 2002), | |? ? ?+? ? ? ? ? ? ? ? settleDate = c(2, 19, 2002), | |? ? ?+? ? ? ? ? ? ? ? dt = 0.01, | |? ? ?+? ? ? ? ? ? ? ? interpWhat = "discount", | |? ? ?+? ? ? ? ? ? ? ? interpHow = "loglinear") | |? ? ?R> tsQuotes <- list(d1w = 0.0382, d1m = 0.0372, fut1 = 96.2875, | |? ? ?+? ? ? ? ? ? ? ? ? fut2 = 96.7875, fut3 = 96.9875, fut4 = 96.6875, | fut5 = | |? ? ?96.4875, | |? ? ?+? ? ? ? ? ? ? ? ? fut6 = 96.3875, fut7 = 96.2875, fut8 = 96.0875, | s3y = | |? ? ?0.0398, | |? ? ?+? ? ? ? ? ? ? ? ? s5y = 0.0443, s10y = 0.05165, s15y = 0.055175) | |? ? ?R> times <- seq(0, 10, 0.1) | |? ? ?R> DiscountCurve(params, tsQuotes, times) | |? ? ?Error: expecting a single value | |? ? ?R> | | | | | |? ? ?Now, there was a (very recent) conversation with Luigi (upstream at | QL) | |? ? ?which | |? ? ?we had, as I recall, mostly in an issue ticket at GH.? That revealed | two | |? ? ?sources of trouble: I had the wrong date, and a bad tenor -- removing | the | |? ? ?s2y | |? ? ?point leads to better / stabler results. | | | |? ? ?With that I (finally!!) reenable the discount curve examples. So from | |? ? ?current | |? ? ?GitHub sources you once again get a meaning 3 x 3 grid of plots. An | example | |? ? ?is below, this of course does not include the chart (which I could | email | |? ? ?you...) but you get a hint of the final values of curves via str() | below. | | | |? ? ?R> library(RQuantLib) | |? ? ?R> example(DiscountCurve) | | | |? ? ?DscntCR> savepar <- par(mfrow=c(3,3), mar=c(4,4,2,0.5)) | | | |? ? ?DscntCR> ## This data is taken from sample code shipped with QuantLib | 0.9.7 | |? ? ?DscntCR> ## from the file Examples/Swap/swapvaluation | |? ? ?DscntCR> params <- list(tradeDate=as.Date('2004-09-20'), | |? ? ?DscntC+? ? ? ? ? ? ? ? settleDate=as.Date('2004-09-22'), | |? ? ?DscntC+? ? ? ? ? ? ? ? dt=.25, | |? ? ?DscntC+? ? ? ? ? ? ? ? interpWhat="discount", | |? ? ?DscntC+? ? ? ? ? ? ? ? interpHow="loglinear") | | | |? ? ?DscntCR> setEvaluationDate(as.Date("2004-09-20")) | |? ? ?[1] TRUE | | | |? ? ?DscntCR> ## We get numerical issue for the spline interpolation if we | add | |? ? ?DscntCR> ## any on of these three extra futures -- the original | example | |? ? ?DscntCR> ## creates different curves based on different deposit, fra, | |? ? ?futures | |? ? ?DscntCR> ## and swap data | |? ? ?DscntCR> ## Removing s2y helps, as kindly pointed out by Luigi | Ballabio | |? ? ?DscntCR> tsQuotes <- list(d1w = 0.0382, | |? ? ?DscntC+? ? ? ? ? ? ? ? ? d1m = 0.0372, | |? ? ?DscntC+? ? ? ? ? ? ? ? ? d3m = 0.0363, | |? ? ?DscntC+? ? ? ? ? ? ? ? ? d6m = 0.0353, | |? ? ?DscntC+? ? ? ? ? ? ? ? ? d9m = 0.0348, | |? ? ?DscntC+? ? ? ? ? ? ? ? ? d1y = 0.0345, | |? ? ?DscntC+? ? ? ? ? ? ? ? ? fut1=96.2875, | |? ? ?DscntC+? ? ? ? ? ? ? ? ? fut2=96.7875, | |? ? ?DscntC+? ? ? ? ? ? ? ? ? fut3=96.9875, | |? ? ?DscntC+? ? ? ? ? ? ? ? ? fut4=96.6875, | |? ? ?DscntC+? ? ? ? ? ? ? ? ? fut5=96.4875, | |? ? ?DscntC+? ? ? ? ? ? ? ? ? fut6=96.3875, | |? ? ?DscntC+? ? ? ? ? ? ? ? ? fut7=96.2875, | |? ? ?DscntC+? ? ? ? ? ? ? ? ? fut8=96.0875, | |? ? ?DscntC+ #? ? ? ? ? ? ? ? ?s2y = 0.037125, | |? ? ?DscntC+? ? ? ? ? ? ? ? ? s3y = 0.0398, | |? ? ?DscntC+? ? ? ? ? ? ? ? ? s5y = 0.0443, | |? ? ?DscntC+? ? ? ? ? ? ? ? ? s10y = 0.05165, | |? ? ?DscntC+? ? ? ? ? ? ? ? ? s15y = 0.055175) | | | |? ? ?DscntCR> times <- seq(0,10,.1) | | | |? ? ?DscntCR> # Loglinear interpolation of discount factors | |? ? ?DscntCR> curves <- DiscountCurve(params, tsQuotes, times) | | | |? ? ?DscntCR> plot(curves,setpar=FALSE) | |? ? ?Hit to see next plot: | | | |? ? ?DscntCR> # Linear interpolation of discount factors | |? ? ?DscntCR> params$interpHow="linear" | | | |? ? ?DscntCR> curves <- DiscountCurve(params, tsQuotes, times) | | | |? ? ?DscntCR> plot(curves,setpar=FALSE) | | | |? ? ?DscntCR> # Spline interpolation of discount factors | |? ? ?DscntCR> params$interpHow="spline" | | | |? ? ?DscntCR> curves <- DiscountCurve(params, tsQuotes, times) | | | |? ? ?DscntCR> plot(curves,setpar=FALSE) | | | |? ? ?DscntCR> par(savepar) | |? ? ?R> str(curves) | |? ? ?List of 7 | |? ? ??$ times? ? ?: num [1:101] 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 ... | |? ? ??$ discounts : num [1:101] 1 0.996 0.993 0.989 0.984 ... | |? ? ??$ forwards? : num [1:101] 0.0367 0.0404 0.0404 0.0287 0.0275 ... | |? ? ??$ zerorates : num [1:101] 0.0392 0.0376 0.0368 0.0379 0.0402 ... | |? ? ??$ flatQuotes: logi FALSE | |? ? ??$ params? ? :List of 5 | |? ? ?? ..$ tradeDate : Date[1:1], format: "2004-09-20" | |? ? ?? ..$ settleDate: Date[1:1], format: "2004-09-22" | |? ? ?? ..$ dt? ? ? ? : num 0.25 | |? ? ?? ..$ interpWhat: chr "discount" | |? ? ?? ..$ interpHow : chr "spline" | |? ? ??$ table? ? ?:'data.frame':? ? ?5479 obs. of? 2 variables: | |? ? ?? ..$ date? ? ?: Date[1:5479], format: "2004-09-22" "2004-09-23" | |? ? ?"2004-09-24" "2004-09-25" ... | |? ? ?? ..$ zeroRates: num [1:5479] 0.0392 0.0392 0.0392 0.0392 0.0392 ... | |? ? ??- attr(*, "class")= chr "DiscountCurve" | |? ? ?R> | | | | | |? ? ?So very much no segfault here on the default example. | | | | | |? ? ?| | |? ? ?| | |? ? ?| R-Error: | |? ? ?| ?*** caught segfault *** | |? ? ?| address 0x20, cause 'memory not mapped' | |? ? ?| | |? ? ?| Traceback: | |? ? ?| ?1: .Call("RQuantLib_discountCurveEngine", PACKAGE = "RQuantLib", ? | ? | |? ? ?rparams, | |? ? ?| tslist, times) | |? ? ?| ?2: discountCurveEngine(params, tsQuotes, times) | |? ? ?| ?3: DiscountCurve.default(params, tsQuotes, times) | |? ? ?| ?4: DiscountCurve(params, tsQuotes, times) | |? ? ?| | |? ? ?| | |? ? ?| I am not in a hurry, just might need to think of doing this on my | own, | |? ? ?but | |? ? ?| pricing bonds on a flat curve is not quite what regular users would | like | |? ? ?to do | |? ? ?| when thinking about QuantLib. | | | |? ? ?We've just overcome this. | | | |? ? ?RQuantLib is coming together. I did a bunch of work in the summer, | then got | |? ? ?sidetracked with travel and conferences and getting back to it. | Michele | |? ? ?helped with two excellent pull requests, and I think we are getting | ready | |? ? ?for | |? ? ?a new release.? The testing you are doing here is very welcome. | | | |? ? ?Cheers, Dirk | | | |? ? ?| | |? ? ?| Happy to provide more details if required. | |? ? ?| | |? ? ?| Regards, | |? ? ?| Ben | |? ? ?| | |? ? ?| -- | |? ? ?| Ben | |? ? ?| _______________________________________________ | |? ? ?| Rquantlib-devel mailing list | |? ? ?| Rquantlib-devel at lists.r-forge.r-project.org | |? ? ?| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/ | |? ? ?rquantlib-devel | | | |? ? ?-- | |? ? ?http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org | | | | | | | | | | -- | | Ben | | -- | http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org | | | -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From thorvall at gmail.com Wed Oct 29 22:33:26 2014 From: thorvall at gmail.com (=?UTF-8?Q?Jess_Thorvall_Aunsbj=C3=B8rn?=) Date: Wed, 29 Oct 2014 22:33:26 +0100 Subject: [Rquantlib-devel] =?utf-8?q?AsianOption=28=E2=80=9Carithmetic?= =?utf-8?b?4oCd4oCmIGNyYXNoZXMgUg==?= Message-ID: Have encountered constant 'crash' of R when calling the AsianOption function with type ?arithmetic?. Posted on StackOverflow yesterday and Dirk asked my to post here instead. Hi I'm trying to use RQuantLib to evaluate arithmetic Asian options on a windows 64 bit platform. Using the geometric pricer the codes executes correct, but using arithmetic crashes R. Have tried in Rstudie and through R-term with both x86 and x64 executable. library('RQuantLib') R version 3.1.1 (2014-07-10) Platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=Danish_Denmark.1252 LC_CTYPE=Danish_Denmark.1252 [3] LC_MONETARY=Danish_Denmark.1252 LC_NUMERIC=C [5] LC_TIME=Danish_Denmark.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] RQuantLib_0.3.12 fOptions_3010.83 fBasics_3010.86 MASS_7.3-35 timeSeries_3010.97 [6] timeDate_3011.99 loaded via a namespace (and not attached): [1] packrat_0.4.1.1 Rcpp_0.11.3 stabledist_0.6-6 tools_3.1.1 GeomOption <- AsianOption("geometric", "put", underlying=80, strike=85, div=0, riskFree=0.005,maturity=1.25, vol=0.2) ArithOption <- AsianOption("arithmetic", "put", underlying=80, strike=85, div=0, riskFree=0.005, maturity=1.25, vol=0.2) I have tried building QuantLib through VS2010 but this makes no difference as expected, since RQuantLib on Windows do not require this. ?Have later tried the same call on a virtual linux mint version. And in contrast to Dirk's expectation, R also crashed on this computer when using 'arithmetric' type. R version 2.15.1 (2012-06-22) Platform: i686-pc-linux-gnu (32-bit) locale: [1] LC_CTYPE=da_DK.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=da_DK.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=da_DK.UTF-8 [7] LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_2.15.1 ? So the problem seems to be more general then the effect of a different package setup on Windows vs Linux. I have tried building QuantLib on windows with succes, but only through VS2010, the MinGW howto's I have found havn't given me enough information to compile, and I havn't either been able to build RQuantLib, but this seems to be a problem with the correct setup of configuration files. ?What are your ideas as how to proceed? Kind regards Jess Aunsbj?rn ? ? -- -- Jess Thorvall Aunsbj?rn Thorvall at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From jack.e.drew at icloud.com Thu Oct 30 22:12:24 2014 From: jack.e.drew at icloud.com (Jack Drew) Date: Thu, 30 Oct 2014 16:12:24 -0500 Subject: [Rquantlib-devel] RQuantLib on Mac OS X 10.10 In-Reply-To: <21583.54590.155746.671550@max.nulle.part> References: <75C25214-B0BF-4C3D-B650-3F22CBC3B214@icloud.com> <21583.54590.155746.671550@max.nulle.part> Message-ID: Yup, works fine within Eclipse if I launch the app through the Terminal. > On Oct 28, 2014, at 12:41 PM, Dirk Eddelbuettel wrote: > > > On 28 October 2014 at 11:35, Jack Drew wrote: > | Recently, I am trying to create a new RQuantLib setup. I am on mac os x 10.10 and R 3.0.2. I have installed QuantLib 1.4, and RQuantLib. From my terminal, within R, I can require RQuantLib and use it with no problems. However, if I try to require RQuantLib within the R GUI or within my StatET Eclipse, I get: > | > | Loading required package: RQuantLib > | Error : .onLoad failed in loadNamespace() for 'RQuantLib', details: > | call: if (is.character(qc) && nchar(qc) > 1) { > | error: missing value where TRUE/FALSE needed > | In addition: Warning message: > | running command 'bash -c 'type -p quantlib-config' 2>/dev/null' had status 1 > | > | I am not sure what I am missing, since the package works fine from the terminal. Please help, if you are able to. > > So quantlib-config is not found. > > I don't own (or access) an OS X machine but even I noticed all these hoopla > over 10.10 not setting PATH -- that could be the culprit. Google for > something like > > RStudio "OS X" 10.10 PATH > > and you just get pointers. One trick appears to be to launch RStudio from > the term.app. > > Dirk > > -- > http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From edd at debian.org Thu Oct 30 22:32:41 2014 From: edd at debian.org (Dirk Eddelbuettel) Date: Thu, 30 Oct 2014 16:32:41 -0500 Subject: [Rquantlib-devel] =?utf-8?q?AsianOption=28=E2=80=9Carithmetic?= =?utf-8?b?4oCd4oCmIGNyYXNoZXMgUg==?= In-Reply-To: References: Message-ID: <21586.44665.306261.260298@max.nulle.part> On 29 October 2014 at 22:33, Jess Thorvall Aunsbj?rn wrote: | Have encountered constant 'crash' of R when calling the?AsianOption function | with type ?arithmetic?. | | Posted on StackOverflow yesterday and Dirk asked my to post here instead. Yes, thanks for that. | Hi I'm trying to use RQuantLib to evaluate arithmetic Asian options on a | windows 64 bit platform. | | Using the geometric pricer the codes executes correct, but using arithmetic | crashes R. Have tried in Rstudie and through R-term with both x86 and x64 | executable. | | library('RQuantLib') | | R version 3.1.1 (2014-07-10) | Platform: x86_64-w64-mingw32/x64 (64-bit) | | locale: | [1] LC_COLLATE=Danish_Denmark.1252 LC_CTYPE=Danish_Denmark.1252 | [3] LC_MONETARY=Danish_Denmark.1252 LC_NUMERIC=C | [5] LC_TIME=Danish_Denmark.1252 | | attached base packages: | [1] stats graphics grDevices utils datasets methods base | | other attached packages: | [1] RQuantLib_0.3.12 fOptions_3010.83 fBasics_3010.86 MASS_7.3-35 timeSeries_3010.97 | [6] timeDate_3011.99 | | loaded via a namespace (and not attached): | [1] packrat_0.4.1.1 Rcpp_0.11.3 stabledist_0.6-6 tools_3.1.1 | | GeomOption <- AsianOption("geometric", "put", underlying=80, strike=85, div=0, riskFree=0.005,maturity=1.25, vol=0.2) | | ArithOption <- AsianOption("arithmetic", "put", underlying=80, strike=85, div=0, riskFree=0.005, maturity=1.25, vol=0.2) | | I have tried building QuantLib through VS2010 but this makes no difference | as expected, since RQuantLib on Windows do not require this. | | ?Have later tried the same call on a virtual linux mint version. | And in contrast to Dirk's expectation, R also crashed on this computer when | using 'arithmetric' type. Beg to differ, our Travis CI checks triggered from GH also run it as we skip the (many years old) test only on Windows. | [cleardot] | | | R version 2.15.1?(2012-06-22) | Platform: i686-pc-linux-gnu (32-bit) | | locale: | ?[1] LC_CTYPE=da_DK.UTF-8 ? ? ? LC_NUMERIC=C ? ? ? ? ? ? ? | ?[3] LC_TIME=en_US.UTF-8 ? ? ? ?LC_COLLATE=da_DK.UTF-8 ? ? | ?[5] LC_MONETARY=en_US.UTF-8 ? ?LC_MESSAGES=da_DK.UTF-8 ?? | ?[7] LC_PAPER=C ? ? ? ? ? ? ? ? LC_NAME=C ? ? ? ? ? ? ? ?? | ?[9] LC_ADDRESS=C ? ? ? ? ? ? ? LC_TELEPHONE=C ? ? ? ? ? ? | [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C ? ? ?? | | attached base packages: | [1] stats ? ? graphics ?grDevices utils ? ? datasets ?methods ? base ? ?? | | loaded via a namespace (and not attached): | [1] tools_2.15.1 | ? | | | So the problem seems to be more general then the effect of a different package | setup on Windows vs Linux. | | I have tried building QuantLib on windows with succes, but only through VS2010, You cannot mix VS2010 and g++ for C++, don't try that. | the MinGW howto's I have found havn't given me enough information to compile, | and I havn't either been able to build RQuantLib, but this seems to be a | problem with the correct setup of configuration files. | | ?What are your ideas as how to?proceed? If you can, please build local versions and debug. I don't do Windows so I am unlikely to get to it. We can help you get QL built using the R toolchain. Dirk | | Kind regards | Jess Aunsbj?rn ? | ? | | -- | -- | Jess Thorvall Aunsbj?rn | Thorvall at gmail.com | | | _______________________________________________ | Rquantlib-devel mailing list | Rquantlib-devel at lists.r-forge.r-project.org | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rquantlib-devel -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From edd at debian.org Thu Oct 30 22:33:27 2014 From: edd at debian.org (Dirk Eddelbuettel) Date: Thu, 30 Oct 2014 16:33:27 -0500 Subject: [Rquantlib-devel] RQuantLib on Mac OS X 10.10 In-Reply-To: References: <75C25214-B0BF-4C3D-B650-3F22CBC3B214@icloud.com> <21583.54590.155746.671550@max.nulle.part> Message-ID: <21586.44711.377326.478040@max.nulle.part> On 30 October 2014 at 16:12, Jack Drew wrote: | Yup, works fine within Eclipse if I launch the app through the Terminal. Thanks for reporting back -- so that was an OS X 10.10 bug, no more, no less. Dirk | > On Oct 28, 2014, at 12:41 PM, Dirk Eddelbuettel wrote: | > | > | > On 28 October 2014 at 11:35, Jack Drew wrote: | > | Recently, I am trying to create a new RQuantLib setup. I am on mac os x 10.10 and R 3.0.2. I have installed QuantLib 1.4, and RQuantLib. From my terminal, within R, I can require RQuantLib and use it with no problems. However, if I try to require RQuantLib within the R GUI or within my StatET Eclipse, I get: | > | | > | Loading required package: RQuantLib | > | Error : .onLoad failed in loadNamespace() for 'RQuantLib', details: | > | call: if (is.character(qc) && nchar(qc) > 1) { | > | error: missing value where TRUE/FALSE needed | > | In addition: Warning message: | > | running command 'bash -c 'type -p quantlib-config' 2>/dev/null' had status 1 | > | | > | I am not sure what I am missing, since the package works fine from the terminal. Please help, if you are able to. | > | > So quantlib-config is not found. | > | > I don't own (or access) an OS X machine but even I noticed all these hoopla | > over 10.10 not setting PATH -- that could be the culprit. Google for | > something like | > | > RStudio "OS X" 10.10 PATH | > | > and you just get pointers. One trick appears to be to launch RStudio from | > the term.app. | > | > Dirk | > | > -- | > http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org | -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org