|
|
@ -37,44 +37,66 @@ namespace MathNet.Numerics.UnitTests.InterpolationTests |
|
|
[TestFixture] |
|
|
[TestFixture] |
|
|
public class InterpolationTest |
|
|
public class InterpolationTest |
|
|
{ |
|
|
{ |
|
|
|
|
|
// Direct Algorithms (without precomputations)
|
|
|
|
|
|
|
|
|
[VerifyContract] |
|
|
[VerifyContract] |
|
|
public readonly IContract LinearSplineContractTests = new InterpolationContract<LinearSplineInterpolation>() |
|
|
public readonly IContract NevillePolynomialContractTests = new InterpolationContract<NevillePolynomialInterpolation>() |
|
|
{ |
|
|
{ |
|
|
Factory = Interpolate.LinearBetweenPoints, |
|
|
Factory = (t, x) => new NevillePolynomialInterpolation(t, x), |
|
|
Order = new[] { 2, 3, 6 }, |
|
|
Order = new[] { 1, 2, 6 }, |
|
|
LinearBehavior = true, |
|
|
LinearBehavior = true, |
|
|
PolynomialBehavior = false, |
|
|
PolynomialBehavior = true, |
|
|
RationalBehavior = false |
|
|
RationalBehavior = false |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
[VerifyContract] |
|
|
[VerifyContract] |
|
|
public readonly IContract FloaterHormannRationalContractTests = new InterpolationContract<FloaterHormannRationalInterpolation>() |
|
|
public readonly IContract BulirschStoerRationalContractTests = new InterpolationContract<BulirschStoerRationalInterpolation>() |
|
|
{ |
|
|
{ |
|
|
Factory = Interpolate.RationalWithoutPoles, |
|
|
Factory = Interpolate.RationalWithPoles, |
|
|
Order = new[] { 1, 2, 6 }, |
|
|
Order = new[] { 1, 2, 6 }, |
|
|
LinearBehavior = true, |
|
|
LinearBehavior = false, |
|
|
PolynomialBehavior = true, |
|
|
PolynomialBehavior = true, |
|
|
RationalBehavior = true |
|
|
RationalBehavior = true |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// Barycentric Algorithms
|
|
|
|
|
|
|
|
|
[VerifyContract] |
|
|
[VerifyContract] |
|
|
public readonly IContract NevillePolynomialContractTests = new InterpolationContract<NevillePolynomialInterpolation>() |
|
|
public readonly IContract BarycentricContractTests = new InterpolationContract<BarycentricInterpolation>() |
|
|
{ |
|
|
{ |
|
|
Factory = (t, x) => new NevillePolynomialInterpolation(t, x), |
|
|
Factory = (t, x) => new BarycentricInterpolation(t, x, FloaterHormannRationalInterpolation.EvaluateBarycentricWeights(t, x, 2)), |
|
|
Order = new[] { 1, 2, 6 }, |
|
|
Order = new[] { 1, 2, 6 }, |
|
|
LinearBehavior = true, |
|
|
NonStandardParameters = true, |
|
|
PolynomialBehavior = true, |
|
|
|
|
|
RationalBehavior = false |
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
[VerifyContract] |
|
|
[VerifyContract] |
|
|
public readonly IContract BulirschStoerRationalContractTests = new InterpolationContract<BulirschStoerRationalInterpolation>() |
|
|
public readonly IContract FloaterHormannRationalContractTests = new InterpolationContract<FloaterHormannRationalInterpolation>() |
|
|
{ |
|
|
{ |
|
|
Factory = Interpolate.RationalWithPoles, |
|
|
Factory = Interpolate.RationalWithoutPoles, |
|
|
Order = new[] { 1, 2, 6 }, |
|
|
Order = new[] { 1, 2, 6 }, |
|
|
LinearBehavior = false, |
|
|
LinearBehavior = true, |
|
|
PolynomialBehavior = true, |
|
|
PolynomialBehavior = true, |
|
|
RationalBehavior = true |
|
|
RationalBehavior = true |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// Spline Algorithms
|
|
|
|
|
|
|
|
|
|
|
|
[VerifyContract] |
|
|
|
|
|
public readonly IContract SplineContractTests = new InterpolationContract<SplineInterpolation>() |
|
|
|
|
|
{ |
|
|
|
|
|
Factory = (t, x) => new SplineInterpolation(t, LinearSplineInterpolation.EvaluateSplineCoefficients(t, x)), |
|
|
|
|
|
Order = new[] { 1, 2, 6 }, |
|
|
|
|
|
NonStandardParameters = true, |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
[VerifyContract] |
|
|
|
|
|
public readonly IContract LinearSplineContractTests = new InterpolationContract<LinearSplineInterpolation>() |
|
|
|
|
|
{ |
|
|
|
|
|
Factory = Interpolate.LinearBetweenPoints, |
|
|
|
|
|
Order = new[] { 2, 3, 6 }, |
|
|
|
|
|
LinearBehavior = true, |
|
|
|
|
|
PolynomialBehavior = false, |
|
|
|
|
|
RationalBehavior = false |
|
|
|
|
|
}; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|