|
From: Alix L. <ali...@gm...> - 2022-09-23 14:33:54
|
Hi Tom,
Thanks for your feedback. I have made a try with your suggestion, but the
code keeps passing even if I deliberately set quadraticity and monotonicity
parameters to negative values - no exception is thrown, while it should.
I don't know what is going on, I even tried to set these parameters to
negative values in the core library (shifting the default ones in
convexmonotoneinterpolation.hpp), and the same behavior again, the code
passed successfully.
I attached my test file again, I feel like either I am missing something
very simple, or this is far beyond my C++ knowledge...
Best,
Alix
Le jeu. 22 sept. 2022 à 18:41, Tom Anderson <tw...@ur...> a écrit :
> On Wed, 14 Sep 2022, Alix Lassauzet wrote:
>
> > While I was investigating the cause of this kink, I tried to play with
> > the 2 extra parameters, quadraticity and monotonicity, and noticed that
> > if I set abnormal values to these parameters (both negative for
> > example), my code does not throw any exception (while the implementation
> > of the class convexmonotoneinterpolation.hpp suggests the code should
> > fail around L201).
> >
> > I can't figure out what is happening:
> > - is my code correct given that no exception is thrown?
> > - Has anyone already experienced this behavior and how do they fix it?
>
> When you create a PiecewiseYieldCurve, you specify the interpolator in two
> ways: as a constructor parameter, but also as a type parameter. Somewhere
> in the guts of the bootstrap process - i can't find it right now, but i'm
> positive there is such a place - the code creates fresh instances of the
> interpolator directly from the type parameter, using its no-argument
> constructor. For ConvexMonotone, that means it uses the default values for
> the icities and forcePositive, and so ignores the ones you specified when
> you created the instance.
>
> In my code, i have dealt with this by creating a subclass of the
> interpolator which sets these to the values i want, eg:
>
> class PureConvexMonotone : public ConvexMonotone {
> public:
> PureConvexMonotone(Real quadraticity = 0.0, Real monotonicity = 1.0,
> bool forcePositive = false)
> : ConvexMonotone(quadraticity, monotonicity, forcePositive) {}
> };
>
> Then using that as the template parameter.
>
> If you can run your code under a debugger, try putting a breakpoint on the
> constructor, and see where you hit it.
>
> tom
>
> --
> Whatever you do, do the best you can, because the film lives forever. --
> Jackie Chan
>
|