From 647acb26cd90943302e3336628c60552c31820f7 Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Fri, 3 Jul 2009 17:07:27 +0800 Subject: [PATCH] interpolation: algorithm constructors as one line init shortcut Signed-off-by: Christoph Ruegg --- .../Algorithms/BarycentricInterpolation.cs | 21 +++++++++++++++++++ .../Algorithms/LinearSplineInterpolation.cs | 13 ++++++++++++ .../RationalPoleFreeInterpolation.cs | 13 ++++++++++++ .../Algorithms/SplineInterpolation.cs | 19 +++++++++++++++++ 4 files changed, 66 insertions(+) diff --git a/src/Managed/Interpolation/Algorithms/BarycentricInterpolation.cs b/src/Managed/Interpolation/Algorithms/BarycentricInterpolation.cs index dfe46197..4539d92e 100644 --- a/src/Managed/Interpolation/Algorithms/BarycentricInterpolation.cs +++ b/src/Managed/Interpolation/Algorithms/BarycentricInterpolation.cs @@ -54,6 +54,27 @@ namespace MathNet.Numerics.Interpolation.Algorithms /// private IList weights; + /// + /// Initializes a new instance of the BarycentricInterpolation class. + /// + public BarycentricInterpolation() + { + } + + /// + /// Initializes a new instance of the BarycentricInterpolation class. + /// + /// Sample Points t + /// Sample Values x(t) + /// Barycentric weights w(t) + public BarycentricInterpolation( + IList samplePoints, + IList sampleValues, + IList barycentricWeights) + { + this.Initialize(samplePoints, sampleValues, barycentricWeights); + } + /// /// Gets a value indicating whether the algorithm supports differentiation (interpolated derivative). /// diff --git a/src/Managed/Interpolation/Algorithms/LinearSplineInterpolation.cs b/src/Managed/Interpolation/Algorithms/LinearSplineInterpolation.cs index 3843f6d5..56eb7935 100644 --- a/src/Managed/Interpolation/Algorithms/LinearSplineInterpolation.cs +++ b/src/Managed/Interpolation/Algorithms/LinearSplineInterpolation.cs @@ -52,6 +52,19 @@ namespace MathNet.Numerics.Interpolation.Algorithms this.spline = new SplineInterpolation(); } + /// + /// Initializes a new instance of the LinearSplineInterpolation class. + /// + /// Sample Points t + /// Sample Values x(samplePoints) + public LinearSplineInterpolation( + IList samplePoints, + IList sampleValues) + { + this.spline = new SplineInterpolation(); + this.Initialize(samplePoints, sampleValues); + } + /// /// Gets a value indicating whether the algorithm supports differentiation (interpolated derivative). /// diff --git a/src/Managed/Interpolation/Algorithms/RationalPoleFreeInterpolation.cs b/src/Managed/Interpolation/Algorithms/RationalPoleFreeInterpolation.cs index 8646afbc..0be10937 100644 --- a/src/Managed/Interpolation/Algorithms/RationalPoleFreeInterpolation.cs +++ b/src/Managed/Interpolation/Algorithms/RationalPoleFreeInterpolation.cs @@ -52,6 +52,19 @@ namespace MathNet.Numerics.Interpolation.Algorithms this.barycentric = new BarycentricInterpolation(); } + /// + /// Initializes a new instance of the RationalPoleFreeInterpolation class. + /// + /// Sample Points t + /// Sample Values x(t) + public RationalPoleFreeInterpolation( + IList samplePoints, + IList sampleValues) + { + this.barycentric = new BarycentricInterpolation(); + this.Initialize(samplePoints, sampleValues); + } + /// /// Gets a value indicating whether the algorithm supports differentiation (interpolated derivative). /// diff --git a/src/Managed/Interpolation/Algorithms/SplineInterpolation.cs b/src/Managed/Interpolation/Algorithms/SplineInterpolation.cs index b11d83e8..f6801878 100644 --- a/src/Managed/Interpolation/Algorithms/SplineInterpolation.cs +++ b/src/Managed/Interpolation/Algorithms/SplineInterpolation.cs @@ -54,6 +54,25 @@ namespace MathNet.Numerics.Interpolation.Algorithms /// private int sampleCount; + /// + /// Initializes a new instance of the SplineInterpolation class. + /// + public SplineInterpolation() + { + } + + /// + /// Initializes a new instance of the SplineInterpolation class. + /// + /// Sample Points t (length: N) + /// Spline Coefficients (length: 4*(N-1)) + public SplineInterpolation( + IList samplePoints, + IList splineCoefficients) + { + this.Initialize(samplePoints, splineCoefficients); + } + /// /// Gets a value indicating whether the algorithm supports differentiation (interpolated derivative). ///