diff --git a/src/Examples/Interpolation/LinearBetweenPoints.cs b/src/Examples/Interpolation/LinearBetweenPoints.cs index a5a6d2b8..c62eb70f 100644 --- a/src/Examples/Interpolation/LinearBetweenPoints.cs +++ b/src/Examples/Interpolation/LinearBetweenPoints.cs @@ -71,7 +71,7 @@ namespace Examples.InterpolationExamples Console.WriteLine(); // 2. Create a linear spline interpolation based on arbitrary points - var method = Interpolate.LinearBetweenPoints(points, values); + var method = Interpolate.LinearSpline(points, values); Console.WriteLine(@"2. Create a linear spline interpolation based on arbitrary points"); Console.WriteLine(); diff --git a/src/Numerics/Interpolate.cs b/src/Numerics/Interpolate.cs index ab256bb1..cffc0446 100644 --- a/src/Numerics/Interpolate.cs +++ b/src/Numerics/Interpolate.cs @@ -4,7 +4,7 @@ // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com // -// Copyright (c) 2009-2010 Math.NET +// Copyright (c) 2009-2013 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation @@ -50,53 +50,59 @@ namespace MathNet.Numerics /// public static IInterpolation Common(IList points, IList values) { - return RationalWithoutPoles(points, values); + return new FloaterHormannRationalInterpolation(points, values); } /// - /// Create a linear spline interpolation based on arbitrary points. + /// Create a floater hormann rational pole-free interpolation based on arbitrary points. /// - /// The sample points t. Optimized for arrays. - /// The sample point values x(t). Optimized for arrays. + /// The sample points t. Supports both lists and arrays. + /// The sample point values x(t). Supports both lists and arrays. /// /// An interpolation scheme optimized for the given sample points and values, /// which can then be used to compute interpolations and extrapolations /// on arbitrary points. /// - /// - /// The value pairs do not have to be sorted, but if they are not sorted ascendingly - /// and the passed x and y arguments are arrays, they will be sorted inplace and thus modified. - /// - public static IInterpolation LinearBetweenPoints(IEnumerable points, IEnumerable values) + public static IInterpolation RationalWithoutPoles(IList points, IList values) { - return LinearSpline.Interpolate(points, values); + return new FloaterHormannRationalInterpolation(points, values); } /// - /// Create an Akima cubic spline interpolation based on arbitrary points. Akima splines are robust to outliers. + /// Create a burlisch stoer rational interpolation based on arbitrary points. /// - /// The sample points t. Optimized for arrays. - /// The sample point values x(t). Optimized for arrays. + /// The sample points t. Supports both lists and arrays. + /// The sample point values x(t). Supports both lists and arrays. /// /// An interpolation scheme optimized for the given sample points and values, /// which can then be used to compute interpolations and extrapolations /// on arbitrary points. /// - /// - /// The value pairs do not have to be sorted, but if they are not sorted ascendingly - /// and the passed x and y arguments are arrays, they will be sorted inplace and thus modified. - /// - public static IInterpolation CubicBetweenPointsRobust(IEnumerable points, IEnumerable values) + public static IInterpolation RationalWithPoles(IList points, IList values) { - return CubicSpline.InterpolateAkima(points, values); + return new BulirschStoerRationalInterpolation(points, values); } /// - /// Create a hermite cubic spline interpolation based on arbitrary points and their slopes/first derivative. + /// Create a barycentric polynomial interpolation where the given sample points are equidistant. + /// + /// The sample points t, must be equidistant. Supports both lists and arrays. + /// The sample point values x(t). Supports both lists and arrays. + /// + /// An interpolation scheme optimized for the given sample points and values, + /// which can then be used to compute interpolations and extrapolations + /// on arbitrary points. + /// + public static IInterpolation PolynomialEquidistant(IList points, IList values) + { + return new EquidistantPolynomialInterpolation(points, values); + } + + /// + /// Create a piecewise linear spline interpolation based on arbitrary points. /// /// The sample points t. Optimized for arrays. /// The sample point values x(t). Optimized for arrays. - /// The slope at the sample points. Optimized for arrays. /// /// An interpolation scheme optimized for the given sample points and values, /// which can then be used to compute interpolations and extrapolations @@ -106,43 +112,48 @@ namespace MathNet.Numerics /// The value pairs do not have to be sorted, but if they are not sorted ascendingly /// and the passed x and y arguments are arrays, they will be sorted inplace and thus modified. /// - public static IInterpolation CubicBetweenPointsWithDerivatives(IEnumerable points, IEnumerable values, IEnumerable firstDerivatives) + public static IInterpolation LinearSpline(IEnumerable points, IEnumerable values) { - return CubicSpline.InterpolateHermite(points, values, firstDerivatives); + return Interpolation.LinearSpline.Interpolate(points, values); } /// - /// Create a floater hormann rational pole-free interpolation based on arbitrary points. + /// Create an piecewise cubic Akima spline interpolation based on arbitrary points. Akima splines are robust to outliers. /// - /// The sample points t. Supports both lists and arrays. - /// The sample point values x(t). Supports both lists and arrays. + /// The sample points t. Optimized for arrays. + /// The sample point values x(t). Optimized for arrays. /// /// An interpolation scheme optimized for the given sample points and values, /// which can then be used to compute interpolations and extrapolations /// on arbitrary points. /// - public static IInterpolation RationalWithoutPoles(IList points, IList values) + /// + /// The value pairs do not have to be sorted, but if they are not sorted ascendingly + /// and the passed x and y arguments are arrays, they will be sorted inplace and thus modified. + /// + public static IInterpolation CubicSplineRobust(IEnumerable points, IEnumerable values) { - var method = new FloaterHormannRationalInterpolation(); - method.Initialize(points, values); - return method; + return Interpolation.CubicSpline.InterpolateAkima(points, values); } /// - /// Create a burlish stoer rational interpolation based on arbitrary points. + /// Create a piecewise cubic Hermite spline interpolation based on arbitrary points and their slopes/first derivative. /// - /// The sample points t. Supports both lists and arrays. - /// The sample point values x(t). Supports both lists and arrays. + /// The sample points t. Optimized for arrays. + /// The sample point values x(t). Optimized for arrays. + /// The slope at the sample points. Optimized for arrays. /// /// An interpolation scheme optimized for the given sample points and values, /// which can then be used to compute interpolations and extrapolations /// on arbitrary points. /// - public static IInterpolation RationalWithPoles(IList points, IList values) + /// + /// The value pairs do not have to be sorted, but if they are not sorted ascendingly + /// and the passed x and y arguments are arrays, they will be sorted inplace and thus modified. + /// + public static IInterpolation CubicSplineWithDerivatives(IEnumerable points, IEnumerable values, IEnumerable firstDerivatives) { - var method = new BulirschStoerRationalInterpolation(); - method.Initialize(points, values); - return method; + return Interpolation.CubicSpline.InterpolateHermite(points, values, firstDerivatives); } } }