Browse Source

Interpolation: adapt new interpolators to v3 api design

provider
Christoph Ruegg 12 years ago
parent
commit
c330723df4
  1. 42
      src/Numerics/Interpolate.cs
  2. 5
      src/Numerics/Interpolation/Barycentric.cs
  3. 2
      src/Numerics/Interpolation/LinearSpline.cs
  4. 85
      src/Numerics/Interpolation/LogLinear.cs
  5. 104
      src/Numerics/Interpolation/StepInterpolation.cs
  6. 175
      src/Numerics/Interpolation/TransformedInterpolation.cs
  7. 76
      src/Numerics/Interpolation/TransformedSpline.cs
  8. 4
      src/Numerics/Numerics.csproj

42
src/Numerics/Interpolate.cs

@ -142,7 +142,7 @@ namespace MathNet.Numerics
} }
/// <summary> /// <summary>
/// Create a piecewise linear spline interpolation based on arbitrary points. /// Create a piecewise linear interpolation based on arbitrary points.
/// </summary> /// </summary>
/// <param name="points">The sample points t.</param> /// <param name="points">The sample points t.</param>
/// <param name="values">The sample point values x(t).</param> /// <param name="values">The sample point values x(t).</param>
@ -156,30 +156,35 @@ namespace MathNet.Numerics
/// MathNet.Numerics.Interpolation.LinearSpline.InterpolateSorted /// MathNet.Numerics.Interpolation.LinearSpline.InterpolateSorted
/// instead, which is more efficient. /// instead, which is more efficient.
/// </remarks> /// </remarks>
public static IInterpolation LinearSpline(IEnumerable<double> points, IEnumerable<double> values) public static IInterpolation Linear(IEnumerable<double> points, IEnumerable<double> values)
{ {
return Interpolation.LinearSpline.Interpolate(points, values); return Interpolation.LinearSpline.Interpolate(points, values);
} }
/// <summary> /// <summary>
/// Create log linear spline interpolation based on arbitrary points. /// Create piecewise log-linear interpolation based on arbitrary points.
/// </summary> /// </summary>
/// <param name="points">The sample points t. Optimized for arrays.</param> /// <param name="points">The sample points t.</param>
/// <param name="values">The sample point values x(t). Optimized for arrays.</param> /// <param name="values">The sample point values x(t).</param>
/// <returns> /// <returns>
/// An interpolation scheme optimized for the given sample points and values, /// An interpolation scheme optimized for the given sample points and values,
/// which can then be used to compute interpolations and extrapolations /// which can then be used to compute interpolations and extrapolations
/// on arbitrary points. /// on arbitrary points.
/// </returns> /// </returns>
/// <remarks> /// <remarks>
/// The value pairs do not have to be sorted, but if they are not sorted ascendingly /// if your data is already sorted in arrays, consider to use
/// and the passed x and y arguments are arrays, they will be sorted inplace and thus modified. /// MathNet.Numerics.Interpolation.LogLinear.InterpolateSorted
/// /// instead, which is more efficient.
/// If the values are passed as an array, they will be modified inplace, even it is already sorted.
/// </remarks> /// </remarks>
public static IInterpolation LogLinearSpline(IEnumerable<double> points, IEnumerable<double> values) public static IInterpolation LogLinear(IEnumerable<double> points, IEnumerable<double> values)
{
return Interpolation.LogLinear.Interpolate(points, values);
}
[Obsolete("Use Linear instead. Will be removed in the next major version.")]
public static IInterpolation LinearSpline(IEnumerable<double> points, IEnumerable<double> values)
{ {
return new LogLinearSpline(points, values); return Interpolation.LinearSpline.Interpolate(points, values);
} }
/// <summary> /// <summary>
@ -247,24 +252,23 @@ namespace MathNet.Numerics
} }
/// <summary> /// <summary>
/// Create log linear spline interpolation based on arbitrary points. /// Create a step-interpolation based on arbitrary points.
/// </summary> /// </summary>
/// <param name="points">The sample points t. Optimized for arrays.</param> /// <param name="points">The sample points t.</param>
/// <param name="values">The sample point values x(t). Optimized for arrays.</param> /// <param name="values">The sample point values x(t).</param>
/// <returns> /// <returns>
/// An interpolation scheme optimized for the given sample points and values, /// An interpolation scheme optimized for the given sample points and values,
/// which can then be used to compute interpolations and extrapolations /// which can then be used to compute interpolations and extrapolations
/// on arbitrary points. /// on arbitrary points.
/// </returns> /// </returns>
/// <remarks> /// <remarks>
/// The value pairs do not have to be sorted, but if they are not sorted ascendingly /// if your data is already sorted in arrays, consider to use
/// and the passed x and y arguments are arrays, they will be sorted inplace and thus modified. /// MathNet.Numerics.Interpolation.StepInterpolation.InterpolateSorted
/// /// instead, which is more efficient.
/// If the values are passed as an array, they will be modified inplace, even it is already sorted.
/// </remarks> /// </remarks>
public static IInterpolation Step(IEnumerable<double> points, IEnumerable<double> values) public static IInterpolation Step(IEnumerable<double> points, IEnumerable<double> values)
{ {
return new StepInterpolation(points, values); return StepInterpolation.Interpolate(points, values);
} }
} }
} }

5
src/Numerics/Interpolation/Barycentric.cs

@ -278,6 +278,11 @@ namespace MathNet.Numerics.Interpolation
get { return false; } get { return false; }
} }
/// <summary>
/// Interpolate at point t.
/// </summary>
/// <param name="t">Point t to interpolate at.</param>
/// <returns>Interpolated value x(t).</returns>
public double Interpolate(double t) public double Interpolate(double t)
{ {
// trivial case: only one sample? // trivial case: only one sample?

2
src/Numerics/Interpolation/LinearSpline.cs

@ -36,7 +36,7 @@ using MathNet.Numerics.Properties;
namespace MathNet.Numerics.Interpolation namespace MathNet.Numerics.Interpolation
{ {
/// <summary> /// <summary>
/// Linear Spline Interpolation. /// Piece-wise Linear Interpolation.
/// </summary> /// </summary>
/// <remarks>Supports both differentiation and integration.</remarks> /// <remarks>Supports both differentiation and integration.</remarks>
public class LinearSpline : IInterpolation public class LinearSpline : IInterpolation

85
src/Numerics/Interpolation/LogLinearSpline.cs → src/Numerics/Interpolation/LogLinear.cs

@ -1,10 +1,10 @@
// <copyright file="LogLinearSpline.cs" company="Math.NET"> // <copyright file="LogLinear.cs" company="Math.NET">
// Math.NET Numerics, part of the Math.NET Project // Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com // http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics // http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com // http://mathnetnumerics.codeplex.com
// //
// Copyright (c) 2009-2013 Math.NET // Copyright (c) 2009-2014 Math.NET
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
@ -32,39 +32,80 @@ using MathNet.Numerics.Properties;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using MathNet.Numerics.Threading;
namespace MathNet.Numerics.Interpolation namespace MathNet.Numerics.Interpolation
{ {
/// <summary> /// <summary>
/// Log Linear Spline Interpolation /// Piece-wise Log-Linear Interpolation
/// </summary> /// </summary>
/// <remarks>This algorithm supports differentiation, not integration.</remarks> /// <remarks>This algorithm supports differentiation, not integration.</remarks>
public class LogLinearSpline : IInterpolation public class LogLinear : IInterpolation
{ {
/// <summary> /// <summary>
/// Internal Spline Interpolation /// Internal Spline Interpolation
/// </summary> /// </summary>
private readonly LinearSpline _spline; readonly LinearSpline _spline;
/// <param name="x">Sample points (N), sorted ascending</param>
/// <param name="logy">Natural logarithm of the sample values (N) at the corresponding points</param>
public LogLinear(double[] x, double[] logy)
{
_spline = LinearSpline.InterpolateSorted(x, logy);
}
/// <summary> /// <summary>
/// Creates a log linear interpolation based on input data /// Create a piecewise log-linear interpolation from a set of (x,y) value pairs, sorted ascendingly by x.
/// </summary> /// </summary>
/// <param name="x"></param> public static LogLinear InterpolateSorted(double[] x, double[] y)
/// <param name="y"></param>
public LogLinearSpline(IEnumerable<double> x, IEnumerable<double> y)
{ {
var xx = (x as double[]) ?? x.ToArray(); if (x.Length != y.Length)
var yy = (y as double[]) ?? y.ToArray(); {
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
}
if (xx.Length != yy.Length) var logy = new double[y.Length];
CommonParallel.For(0, y.Length, 4096, (a, b) =>
{
for (int i = a; i < b; i++)
{
logy[i] = Math.Log(y[i]);
}
});
return new LogLinear(x, logy);
}
/// <summary>
/// Create a piecewise log-linear interpolation from an unsorted set of (x,y) value pairs.
/// WARNING: Works in-place and can thus causes the data array to be reordered and modified.
/// </summary>
public static LogLinear InterpolateInplace(double[] x, double[] y)
{
if (x.Length != y.Length)
{ {
throw new ArgumentException(Resources.ArgumentVectorsSameLength); throw new ArgumentException(Resources.ArgumentVectorsSameLength);
} }
for (int i = 0; i < yy.Length; i++) Sorting.Sort(x, y);
yy[i] = Math.Log(yy[i]); CommonParallel.For(0, y.Length, 4096, (a, b) =>
{
for (int i = a; i < b; i++)
{
y[i] = Math.Log(y[i]);
}
});
_spline = LinearSpline.Interpolate(xx, yy); return new LogLinear(x, y);
}
/// <summary>
/// Create a piecewise log-linear interpolation from an unsorted set of (x,y) value pairs.
/// </summary>
public static LogLinear Interpolate(IEnumerable<double> x, IEnumerable<double> y)
{
// note: we must make a copy, even if the input was arrays already
return InterpolateInplace(x.ToArray(), y.ToArray());
} }
/// <summary> /// <summary>
@ -100,7 +141,7 @@ namespace MathNet.Numerics.Interpolation
/// <returns>Interpolated first derivative at point t.</returns> /// <returns>Interpolated first derivative at point t.</returns>
public double Differentiate(double t) public double Differentiate(double t)
{ {
return Interpolate(t) * _spline.Differentiate(t); return Interpolate(t)*_spline.Differentiate(t);
} }
/// <summary> /// <summary>
@ -113,8 +154,8 @@ namespace MathNet.Numerics.Interpolation
var linearFirstDerivative = _spline.Differentiate(t); var linearFirstDerivative = _spline.Differentiate(t);
var linearSecondDerivative = _spline.Differentiate2(t); var linearSecondDerivative = _spline.Differentiate2(t);
var secondDerivative = Differentiate(t) * linearFirstDerivative + var secondDerivative = Differentiate(t)*linearFirstDerivative +
Interpolate(t) * linearSecondDerivative; Interpolate(t)*linearSecondDerivative;
return secondDerivative; return secondDerivative;
} }
@ -123,9 +164,9 @@ namespace MathNet.Numerics.Interpolation
/// Indefinite integral at point t. /// Indefinite integral at point t.
/// </summary> /// </summary>
/// <param name="t">Point t to integrate at.</param> /// <param name="t">Point t to integrate at.</param>
public double Integrate(double t) double IInterpolation.Integrate(double t)
{ {
throw new NotImplementedException(); throw new NotSupportedException();
} }
/// <summary> /// <summary>
@ -133,9 +174,9 @@ namespace MathNet.Numerics.Interpolation
/// </summary> /// </summary>
/// <param name="a">Left bound of the integration interval [a,b].</param> /// <param name="a">Left bound of the integration interval [a,b].</param>
/// <param name="b">Right bound of the integration interval [a,b].</param> /// <param name="b">Right bound of the integration interval [a,b].</param>
public double Integrate(double a, double b) double IInterpolation.Integrate(double a, double b)
{ {
throw new NotImplementedException(); throw new NotSupportedException();
} }
} }
} }

104
src/Numerics/Interpolation/StepInterpolation.cs

@ -36,52 +36,104 @@ using MathNet.Numerics.Properties;
namespace MathNet.Numerics.Interpolation namespace MathNet.Numerics.Interpolation
{ {
/// <summary> /// <summary>
/// A step function where the start of each segment is included, and last is excluded. Segment i is [x_i, x_i+1). /// A step function where the start of each segment is included, and last is excluded.
/// Segment i is [x_i, x_i+1).
/// The domain of the function is all real numbers, such that y = 0 where x &lt; x_0 or x gt; x_n /// The domain of the function is all real numbers, such that y = 0 where x &lt; x_0 or x gt; x_n
/// </summary> /// </summary>
/// <remarks>Supports both differentiation and integration.</remarks>
public class StepInterpolation : IInterpolation public class StepInterpolation : IInterpolation
{ {
readonly double[] _x; readonly double[] _x;
readonly double[] _y; readonly double[] _y;
readonly Lazy<double[]> _indefiniteIntegral; readonly Lazy<double[]> _indefiniteIntegral;
/// <param name="x">Sample points (N+1) sorted in ascending order</param> /// <param name="x">Sample points (N+1), sorted ascending</param>
/// <param name="y">Functional value (N) of each segment.</param> /// <param name="sy">Functional values (N) of each segment</param>
public StepInterpolation(IEnumerable<double> x, IEnumerable<double> y) public StepInterpolation(double[] x, double[] sy)
{ {
var xx = (x as double[]) ?? x.ToArray(); if (x.Length != sy.Length + 1)
var yy = (y as double[]) ?? y.ToArray();
if (xx.Length != yy.Length + 1)
{ {
throw new ArgumentException(Resources.ArgumentVectorsSameLength); throw new ArgumentException(Resources.ArgumentVectorsSameLength);
} }
_x = xx; _x = x;
_y = yy; _y = sy;
_indefiniteIntegral = new Lazy<double[]>(ComputeIndefiniteIntegral); _indefiniteIntegral = new Lazy<double[]>(ComputeIndefiniteIntegral);
} }
double[] ComputeIndefiniteIntegral() /// <summary>
/// Create a linear spline interpolation from a set of (x,y) value pairs, sorted ascendingly by x.
/// The y-value corresponding to the largest x-sample is ignored.
/// </summary>
public static StepInterpolation InterpolateSorted(double[] x, double[] y)
{ {
var integral = new double[_x.Length]; if (x.Length != y.Length)
for (int i = 0; i < integral.Length - 1; i++)
{ {
integral[i + 1] = integral[i] + (_x[i + 1] - _x[i])*_y[i]; throw new ArgumentException(Resources.ArgumentVectorsSameLength);
} }
return integral;
// drop the last value which is not part of any segment.
var segmentValues = new double[x.Length - 1];
Array.Copy(y, 0, segmentValues, 0, segmentValues.Length);
return new StepInterpolation(x, segmentValues);
} }
public bool SupportsDifferentiation /// <summary>
/// Create a linear spline interpolation from an unsorted set of (x,y) value pairs.
/// The y-value corresponding to the largest x-sample is ignored.
/// WARNING: Works in-place and can thus causes the data array to be reordered.
/// </summary>
public static StepInterpolation InterpolateInplace(double[] x, double[] y)
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
}
Sorting.Sort(x, y);
return InterpolateSorted(x, y);
}
/// <summary>
/// Create a linear spline interpolation from an unsorted set of (x,y) value pairs.
/// The y-value corresponding to the largest x-sample is ignored.
/// </summary>
public static StepInterpolation Interpolate(IEnumerable<double> x, IEnumerable<double> y)
{
// note: we must make a copy, even if the input was arrays already
return InterpolateInplace(x.ToArray(), y.ToArray());
}
bool IInterpolation.SupportsDifferentiation
{ {
get { return true; } get { return true; }
} }
public bool SupportsIntegration bool IInterpolation.SupportsIntegration
{ {
get { return true; } get { return true; }
} }
/// <summary>
/// Interpolate at point t.
/// </summary>
/// <param name="t">Point t to interpolate at.</param>
/// <returns>Interpolated value x(t).</returns>
public double Interpolate(double t)
{
if (t < _x[0] || t >= _x[_x.Length - 1])
return 0.0;
int k = LeftBracketIndex(t);
return _y[k];
}
/// <summary>
/// Differentiate at point t.
/// </summary>
/// <param name="t">Point t to interpolate at.</param>
/// <returns>Interpolated first derivative at point t.</returns>
public double Differentiate(double t) public double Differentiate(double t)
{ {
int index = Array.BinarySearch(_x, t); int index = Array.BinarySearch(_x, t);
@ -90,6 +142,11 @@ namespace MathNet.Numerics.Interpolation
return 0d; return 0d;
} }
/// <summary>
/// Differentiate twice at point t.
/// </summary>
/// <param name="t">Point t to interpolate at.</param>
/// <returns>Interpolated second derivative at point t.</returns>
public double Differentiate2(double t) public double Differentiate2(double t)
{ {
return Differentiate(t); return Differentiate(t);
@ -122,13 +179,14 @@ namespace MathNet.Numerics.Interpolation
return Integrate(b) - Integrate(a); return Integrate(b) - Integrate(a);
} }
public double Interpolate(double t) double[] ComputeIndefiniteIntegral()
{ {
if (t < _x[0] || t >= _x[_x.Length - 1]) var integral = new double[_x.Length];
return 0.0; for (int i = 0; i < integral.Length - 1; i++)
{
int k = LeftBracketIndex(t); integral[i + 1] = integral[i] + (_x[i + 1] - _x[i])*_y[i];
return _y[k]; }
return integral;
} }
/// <summary> /// <summary>

175
src/Numerics/Interpolation/TransformedInterpolation.cs

@ -0,0 +1,175 @@
// <copyright file="TransformedInterpolation.cs" company="Math.NET">
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com
//
// Copyright (c) 2009-2014 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using MathNet.Numerics.Properties;
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Threading;
namespace MathNet.Numerics.Interpolation
{
public class TransformedInterpolation : IInterpolation
{
readonly IInterpolation _interpolation;
readonly Func<double, double> _transform;
public TransformedInterpolation(IInterpolation interpolation, Func<double, double> transform)
{
_interpolation = interpolation;
_transform = transform;
}
/// <summary>
/// Create a linear spline interpolation from a set of (x,y) value pairs, sorted ascendingly by x.
/// </summary>
public static TransformedInterpolation InterpolateSorted(
Func<double, double> transform, Func<double, double> transformInverse,
double[] x, double[] y)
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
}
var yhat = new double[y.Length];
CommonParallel.For(0, y.Length, 4096, (a, b) =>
{
for (int i = a; i < b; i++)
{
yhat[i] = transformInverse(y[i]);
}
});
return new TransformedInterpolation(LinearSpline.InterpolateSorted(x, yhat), transform);
}
/// <summary>
/// Create a linear spline interpolation from an unsorted set of (x,y) value pairs.
/// WARNING: Works in-place and can thus causes the data array to be reordered and modified.
/// </summary>
public static TransformedInterpolation InterpolateInplace(
Func<double, double> transform, Func<double, double> transformInverse,
double[] x, double[] y)
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
}
Sorting.Sort(x, y);
CommonParallel.For(0, y.Length, 4096, (a, b) =>
{
for (int i = a; i < b; i++)
{
y[i] = transformInverse(y[i]);
}
});
return new TransformedInterpolation(LinearSpline.InterpolateSorted(x, y), transform);
}
/// <summary>
/// Create a linear spline interpolation from an unsorted set of (x,y) value pairs.
/// </summary>
public static TransformedInterpolation Interpolate(
Func<double, double> transform, Func<double, double> transformInverse,
IEnumerable<double> x, IEnumerable<double> y)
{
// note: we must make a copy, even if the input was arrays already
return InterpolateInplace(transform, transformInverse, x.ToArray(), y.ToArray());
}
/// <summary>
/// Gets a value indicating whether the algorithm supports differentiation (interpolated derivative).
/// </summary>
bool IInterpolation.SupportsDifferentiation
{
get { return false; }
}
/// <summary>
/// Gets a value indicating whether the algorithm supports integration (interpolated quadrature).
/// </summary>
bool IInterpolation.SupportsIntegration
{
get { return false; }
}
/// <summary>
/// Interpolate at point t.
/// </summary>
/// <param name="t">Point t to interpolate at.</param>
/// <returns>Interpolated value x(t).</returns>
public double Interpolate(double t)
{
return _transform(_interpolation.Interpolate(t));
}
/// <summary>
/// Differentiate at point t. NOT SUPPORTED.
/// </summary>
/// <param name="t">Point t to interpolate at.</param>
/// <returns>Interpolated first derivative at point t.</returns>
double IInterpolation.Differentiate(double t)
{
throw new NotSupportedException();
}
/// <summary>
/// Differentiate twice at point t. NOT SUPPORTED.
/// </summary>
/// <param name="t">Point t to interpolate at.</param>
/// <returns>Interpolated second derivative at point t.</returns>
double IInterpolation.Differentiate2(double t)
{
throw new NotSupportedException();
}
/// <summary>
/// Indefinite integral at point t. NOT SUPPORTED.
/// </summary>
/// <param name="t">Point t to integrate at.</param>
double IInterpolation.Integrate(double t)
{
throw new NotSupportedException();
}
/// <summary>
/// Definite integral between points a and b. NOT SUPPORTED.
/// </summary>
/// <param name="a">Left bound of the integration interval [a,b].</param>
/// <param name="b">Right bound of the integration interval [a,b].</param>
double IInterpolation.Integrate(double a, double b)
{
throw new NotSupportedException();
}
}
}

76
src/Numerics/Interpolation/TransformedSpline.cs

@ -1,76 +0,0 @@
using MathNet.Numerics.Properties;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MathNet.Numerics.Interpolation
{
public class TransformedInterpolation : IInterpolation
{
private IInterpolation _baseInterpolation;
private Func<double, double> _transformer;
public TransformedInterpolation(IInterpolation baseInterp, Func<double, double> transformer)
{
_baseInterpolation = baseInterp;
_transformer = transformer;
}
public static TransformedInterpolation Interpolate(
Func<double, double> transformer, Func<double, double> transformerInverse,
IEnumerable<double> x, IEnumerable<double> y)
{
var xx = (x as double[]) ?? x.ToArray();
var yy = (y as double[]) ?? y.ToArray();
if (xx.Length != yy.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
}
for (int i = 0; i < yy.Length; i++)
yy[i] = transformerInverse(yy[i]);
var baseInterp = LinearSpline.Interpolate(xx, yy);
var interp = new TransformedInterpolation(baseInterp, transformer);
return interp;
}
public bool SupportsDifferentiation
{
get { return false; }
}
public bool SupportsIntegration
{
get { return false; }
}
public double Differentiate(double t)
{
throw new NotImplementedException();
}
public double Differentiate2(double t)
{
throw new NotImplementedException();
}
public double Integrate(double t)
{
throw new NotImplementedException();
}
public double Integrate(double a, double b)
{
throw new NotImplementedException();
}
public double Interpolate(double t)
{
return _transformer(_baseInterpolation.Interpolate(t));
}
}
}

4
src/Numerics/Numerics.csproj

@ -91,10 +91,10 @@
<Compile Include="IntegralTransforms\Hartley.cs" /> <Compile Include="IntegralTransforms\Hartley.cs" />
<Compile Include="Interpolation\Barycentric.cs" /> <Compile Include="Interpolation\Barycentric.cs" />
<Compile Include="Interpolation\CubicSpline.cs" /> <Compile Include="Interpolation\CubicSpline.cs" />
<Compile Include="Interpolation\LogLinearSpline.cs" /> <Compile Include="Interpolation\LogLinear.cs" />
<Compile Include="Interpolation\QuadraticSpline.cs" /> <Compile Include="Interpolation\QuadraticSpline.cs" />
<Compile Include="Interpolation\StepInterpolation.cs" /> <Compile Include="Interpolation\StepInterpolation.cs" />
<Compile Include="Interpolation\TransformedSpline.cs" /> <Compile Include="Interpolation\TransformedInterpolation.cs" />
<Compile Include="LinearAlgebra\Options.cs" /> <Compile Include="LinearAlgebra\Options.cs" />
<Compile Include="LinearAlgebra\Solvers\DelegateStopCriterion.cs" /> <Compile Include="LinearAlgebra\Solvers\DelegateStopCriterion.cs" />
<Compile Include="LinearRegression\Options.cs" /> <Compile Include="LinearRegression\Options.cs" />

Loading…
Cancel
Save