/// <summary> /// Initialize the interpolation method with the given sampls in the interval [leftBound,rightBound]. /// </summary> /// <param name="leftBound">Left bound of the sample point interval.</param> /// <param name="rightBound">Right bound of the sample point interval.</param> /// <param name="sampleValues">Sample Values x(t) where t are equidistant over [a,b], i.e. x[i] = x(a+(b-a)*i/(n-1))</param> public void Initialize( double leftBound, double rightBound, IList <double> sampleValues) { if (null == sampleValues) { throw new ArgumentNullException("sampleValues"); } if (sampleValues.Count < 1) { throw new ArgumentOutOfRangeException("sampleValues"); } var samplePoints = new double[sampleValues.Count]; samplePoints[0] = leftBound; double step = (rightBound - leftBound) / (samplePoints.Length - 1); for (int i = 1; i < samplePoints.Length; i++) { samplePoints[i] = samplePoints[i - 1] + step; } var weights = EvaluateBarycentricWeights(sampleValues.Count); _barycentric.Initialize(samplePoints, sampleValues, weights); }
/// <summary> /// Initialize the interpolation method with the given sample set. /// </summary> /// <remarks> /// The interpolation scheme order will be set to 3. /// </remarks> /// <param name="samplePoints">Sample Points t (no sorting assumed)</param> /// <param name="sampleValues">Sample Values x(t)</param> public void Initialize( IList <double> samplePoints, IList <double> sampleValues) { if (null == samplePoints) { throw new ArgumentNullException("samplePoints"); } double[] weights = EvaluateBarycentricWeights( samplePoints, sampleValues, Math.Min(3, samplePoints.Count - 1)); _barycentric.Initialize(samplePoints, sampleValues, weights); }