Hello,
I'm currently using SWIG to access QuantLib via C# and am able to use InterpolatedZeroCurve from QuantLib via ZeroCurve from SWIG. This class only supports linear interpolation and I need to use cubic, log-cubic, log-linear, foward flat, backward flat, and monotonic. I looked at the zerocurve.i file and tried creating cubiczerocurve.i, built NQuantLib, and use the package, but I don't see the new class. I also tried uncommenting the line in zerocurve.i where it reads export_zero_curve(CubicZeroCurve,Cubic); However this did nothing after building, etc. Obviously I'm missing a crucial step somewhere, so if someone could point me in the right direction, we could soon have multiple interpolation types supported via SWIG :) Grant |
Uncommenting the additional export_zero_curve should have worked (and in fact, the whole idea of defining that macro was to make it easier to export more curves). After SWIG runs, is CubicZeroCurve.cs generated in the csharp folder? Is CubicZeroCurve mentioned at all in the generated quantlib_wrap.cpp? On Fri, Oct 28, 2016 at 10:40 AM grantathon <[hidden email]> wrote: Hello, ------------------------------------------------------------------------------ The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
I uncommented export_zero_curve(CubicZeroCurve,Cubic), ran the swig.cmd file in QuantLib-SWIG\CSharp, built NQuantLib in Visual Studio, and I still don't see any CubicZeroCurve among the C# classes nor do I see any changes in the quantlib_wrap.cpp.
I guess there is something else I should do other than running the swig.cmd file followed by building NQuantLib in Visual Studio? |
Hmm. No, you shouldn't do anything else. May you try running the command inside swig.cmd directly? I suspect it might be swallowing an error. On Sat, Oct 29, 2016, 10:41 grantathon <[hidden email]> wrote: I uncommented export_zero_curve(CubicZeroCurve,Cubic), ran the swig.cmd file ------------------------------------------------------------------------------ The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
This post was updated on .
I ran swig.cmd via the command line and realized I wasn't referencing swig.exe properly. After editing swig.cmd to source swig.exe, I was able to generate LogLinearZeroCurve, CubicZeroCurve, ForwardFlatZeroCurve, BackwardFlatZeroCurve, and MonotonicCubicZeroCurve by adding
export_zero_curve(LogLinearZeroCurve,LogLinear); export_zero_curve(CubicZeroCurve,Cubic); export_zero_curve(ForwardFlatZeroCurve,ForwardFlat); export_zero_curve(BackwardFlatZeroCurve,BackwardFlat); export_zero_curve(MonotonicCubicZeroCurve,MonotonicCubic); to zerocurve.i. I can also use them in my C# applications now! Unfortunately, I was not successful in generating LogCubicZeroCurve using export_zero_curve(LogCubicZeroCurve,QuantLib::LogCubic); nor export_zero_curve(LogCubicZeroCurve,LogCubic); due to some build errors in NQuantLibc. The build errors and output are Looks like they indicate that there are some private resource (requiredPoints and interpolate) within the LogCubic class. However, when looking at the QuantLib code, both of those resources are made public (see LogCubic in loginterpolation.hpp). Any ideas on how to resolve this issue? |
In SWIG/interpolation.i at line 187, try replacing class LogCubic : QuantLib::LogCubic { with class LogCubic : public QuantLib::LogCubic { and send me a pull request if that works :) Luigi On Fri, Nov 4, 2016 at 9:50 AM grantathon <[hidden email]> wrote: I ran swig.cmd via the command line and realized I wasn't referencing ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
That worked! I'll send you a pull request now :)
|
Free forum by Nabble | Edit this page |