From 4cd34f9dd893a5a054801e607f0315314df1e6eb Mon Sep 17 00:00:00 2001 From: Konstantin Novitsky Date: Tue, 21 Jan 2025 19:44:51 -0500 Subject: [PATCH] MixedInterpolationImpl fixes --- src/QLNet/Math/Interpolations/MixedInterpolation.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/QLNet/Math/Interpolations/MixedInterpolation.cs b/src/QLNet/Math/Interpolations/MixedInterpolation.cs index 27de435d..374b4d7c 100644 --- a/src/QLNet/Math/Interpolations/MixedInterpolation.cs +++ b/src/QLNet/Math/Interpolations/MixedInterpolation.cs @@ -47,8 +47,8 @@ public MixedInterpolationImpl(List xBegin, int xEnd, { n_ = n; - xBegin2_ = xBegin.GetRange(n_, xBegin.Count); - yBegin2_ = yBegin.GetRange(n_, yBegin.Count); + xBegin2_ = xBegin.GetRange(n_, xBegin.Count - n_); + yBegin2_ = yBegin.GetRange(n_, yBegin.Count - n_); Utils.QL_REQUIRE(xBegin2_.Count < size_, () => "too large n (" + n + ") for " + size_ + "-element x sequence"); @@ -59,8 +59,8 @@ public MixedInterpolationImpl(List xBegin, int xEnd, interpolation2_ = factory2.interpolate(xBegin_, size_, yBegin_); break; case Behavior.SplitRanges: - interpolation1_ = factory1.interpolate(xBegin_, xBegin2_.Count + 1, yBegin_); - interpolation2_ = factory2.interpolate(xBegin2_, size_, yBegin2_); + interpolation1_ = factory1.interpolate(xBegin_, n_, yBegin_); + interpolation2_ = factory2.interpolate(xBegin2_, size_ - n, yBegin2_); break; default: Utils.QL_FAIL("unknown mixed-interpolation behavior: " + behavior); @@ -137,7 +137,7 @@ public MixedLinearCubicInterpolation(List xBegin, int xEnd, //! mixed linear/cubic interpolation factory and traits /*! \ingroup interpolations */ - public class MixedLinearCubic + public class MixedLinearCubic: IInterpolationFactory { public MixedLinearCubic(int n, Behavior behavior,