diff --git a/src/Examples/Interpolation/AkimaSpline.cs b/src/Examples/Interpolation/AkimaSpline.cs
index db71ea25..196bf33a 100644
--- a/src/Examples/Interpolation/AkimaSpline.cs
+++ b/src/Examples/Interpolation/AkimaSpline.cs
@@ -26,7 +26,6 @@
using System;
using MathNet.Numerics.Interpolation;
-using MathNet.Numerics.Interpolation.Algorithms;
using MathNet.Numerics.Random;
using MathNet.Numerics.Signals;
diff --git a/src/Examples/Interpolation/LinearBetweenPoints.cs b/src/Examples/Interpolation/LinearBetweenPoints.cs
index a5f4fd4b..51b3dcaf 100644
--- a/src/Examples/Interpolation/LinearBetweenPoints.cs
+++ b/src/Examples/Interpolation/LinearBetweenPoints.cs
@@ -25,6 +25,7 @@
//
using System;
+using MathNet.Numerics;
using MathNet.Numerics.Interpolation;
using MathNet.Numerics.Random;
using MathNet.Numerics.Signals;
diff --git a/src/Examples/Interpolation/RationalWithPoles.cs b/src/Examples/Interpolation/RationalWithPoles.cs
index b9abf137..a342ec20 100644
--- a/src/Examples/Interpolation/RationalWithPoles.cs
+++ b/src/Examples/Interpolation/RationalWithPoles.cs
@@ -25,6 +25,7 @@
//
using System;
+using MathNet.Numerics;
using MathNet.Numerics.Interpolation;
using MathNet.Numerics.Random;
using MathNet.Numerics.Signals;
diff --git a/src/Examples/Interpolation/RationalWithoutPoles.cs b/src/Examples/Interpolation/RationalWithoutPoles.cs
index 0b23fa68..c9848547 100644
--- a/src/Examples/Interpolation/RationalWithoutPoles.cs
+++ b/src/Examples/Interpolation/RationalWithoutPoles.cs
@@ -25,6 +25,7 @@
//
using System;
+using MathNet.Numerics;
using MathNet.Numerics.Interpolation;
using MathNet.Numerics.Random;
using MathNet.Numerics.Signals;
diff --git a/src/Numerics/Interpolation/Interpolate.cs b/src/Numerics/Interpolate.cs
similarity index 97%
rename from src/Numerics/Interpolation/Interpolate.cs
rename to src/Numerics/Interpolate.cs
index 91cb0af2..8398fd3d 100644
--- a/src/Numerics/Interpolation/Interpolate.cs
+++ b/src/Numerics/Interpolate.cs
@@ -28,11 +28,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
-namespace MathNet.Numerics.Interpolation
-{
- using System.Collections.Generic;
- using Algorithms;
+using System.Collections.Generic;
+using MathNet.Numerics.Interpolation;
+namespace MathNet.Numerics
+{
///
/// Interpolation Factory.
///
diff --git a/src/Numerics/Interpolation/Algorithms/AkimaSplineInterpolation.cs b/src/Numerics/Interpolation/AkimaSplineInterpolation.cs
similarity index 92%
rename from src/Numerics/Interpolation/Algorithms/AkimaSplineInterpolation.cs
rename to src/Numerics/Interpolation/AkimaSplineInterpolation.cs
index 98b3016a..3786d9de 100644
--- a/src/Numerics/Interpolation/Algorithms/AkimaSplineInterpolation.cs
+++ b/src/Numerics/Interpolation/AkimaSplineInterpolation.cs
@@ -28,12 +28,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
-namespace MathNet.Numerics.Interpolation.Algorithms
-{
- using System;
- using System.Collections.Generic;
- using Properties;
+using System;
+using System.Collections.Generic;
+using MathNet.Numerics.Properties;
+namespace MathNet.Numerics.Interpolation
+{
///
/// Akima Spline Interpolation Algorithm.
///
@@ -45,7 +45,7 @@ namespace MathNet.Numerics.Interpolation.Algorithms
///
/// Internal Spline Interpolation
///
- private readonly CubicHermiteSplineInterpolation _spline;
+ readonly CubicHermiteSplineInterpolation _spline;
///
/// Initializes a new instance of the AkimaSplineInterpolation class.
@@ -147,7 +147,7 @@ namespace MathNet.Numerics.Interpolation.Algorithms
for (int i = 0; i < differences.Length; i++)
{
- differences[i] = (sampleValues[i + 1] - sampleValues[i]) / (samplePoints[i + 1] - samplePoints[i]);
+ differences[i] = (sampleValues[i + 1] - sampleValues[i])/(samplePoints[i + 1] - samplePoints[i]);
}
for (int i = 1; i < weights.Length; i++)
@@ -163,16 +163,16 @@ namespace MathNet.Numerics.Interpolation.Algorithms
{
derivatives[i] =
weights[i - 1].AlmostEqual(0.0) && weights[i + 1].AlmostEqual(0.0)
- ? (((samplePoints[i + 1] - samplePoints[i]) * differences[i - 1])
- + ((samplePoints[i] - samplePoints[i - 1]) * differences[i]))
- / (samplePoints[i + 1] - samplePoints[i - 1])
- : ((weights[i + 1] * differences[i - 1])
- + (weights[i - 1] * differences[i]))
- / (weights[i + 1] + weights[i - 1]);
+ ? (((samplePoints[i + 1] - samplePoints[i])*differences[i - 1])
+ + ((samplePoints[i] - samplePoints[i - 1])*differences[i]))
+ /(samplePoints[i + 1] - samplePoints[i - 1])
+ : ((weights[i + 1]*differences[i - 1])
+ + (weights[i - 1]*differences[i]))
+ /(weights[i + 1] + weights[i - 1]);
}
derivatives[0] = DifferentiateThreePoint(samplePoints, sampleValues, 0, 0, 1, 2);
- derivatives[1] = DifferentiateThreePoint(samplePoints, sampleValues, 1, 0, 1, 2);
+ derivatives[1] = DifferentiateThreePoint(samplePoints, sampleValues, 1, 0, 1, 2);
derivatives[n - 2] = DifferentiateThreePoint(samplePoints, sampleValues, n - 2, n - 3, n - 2, n - 1);
derivatives[n - 1] = DifferentiateThreePoint(samplePoints, sampleValues, n - 1, n - 3, n - 2, n - 1);
@@ -212,7 +212,7 @@ namespace MathNet.Numerics.Interpolation.Algorithms
/// Index of the second sample.
/// Index of the third sample.
/// The derivative approximation.
- private static double DifferentiateThreePoint(
+ static double DifferentiateThreePoint(
IList samplePoints,
IList sampleValues,
int indexT,
@@ -228,9 +228,9 @@ namespace MathNet.Numerics.Interpolation.Algorithms
double t1 = samplePoints[index1] - samplePoints[index0];
double t2 = samplePoints[index2] - samplePoints[index0];
- double a = (x2 - x0 - (t2 / t1 * (x1 - x0))) / ((t2 * t2) - (t1 * t2));
- double b = (x1 - x0 - (a * t1 * t1)) / t1;
- return (2 * a * t) + b;
+ double a = (x2 - x0 - (t2/t1*(x1 - x0)))/((t2*t2) - (t1*t2));
+ double b = (x1 - x0 - (a*t1*t1))/t1;
+ return (2*a*t) + b;
}
///
@@ -283,4 +283,4 @@ namespace MathNet.Numerics.Interpolation.Algorithms
return _spline.Integrate(t);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Numerics/Interpolation/Algorithms/BarycentricInterpolation.cs b/src/Numerics/Interpolation/BarycentricInterpolation.cs
similarity index 95%
rename from src/Numerics/Interpolation/Algorithms/BarycentricInterpolation.cs
rename to src/Numerics/Interpolation/BarycentricInterpolation.cs
index 58fed27c..17ec2022 100644
--- a/src/Numerics/Interpolation/Algorithms/BarycentricInterpolation.cs
+++ b/src/Numerics/Interpolation/BarycentricInterpolation.cs
@@ -28,11 +28,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
-namespace MathNet.Numerics.Interpolation.Algorithms
-{
- using System;
- using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
+namespace MathNet.Numerics.Interpolation
+{
///
/// Barycentric Interpolation Algorithm.
///
@@ -44,17 +44,17 @@ namespace MathNet.Numerics.Interpolation.Algorithms
///
/// Sample Points t.
///
- private IList _points;
+ IList _points;
///
/// Sample Values x(t).
///
- private IList _values;
+ IList _values;
///
/// Barycentric Weights w(t).
///
- private IList _weights;
+ IList _weights;
///
/// Initializes a new instance of the BarycentricInterpolation class.
@@ -187,19 +187,19 @@ namespace MathNet.Numerics.Interpolation.Algorithms
{
if (i != closestPoint)
{
- double v = offset * _weights[i] / (t - _points[i]);
- s1 = s1 + (v * _values[i]);
+ double v = offset*_weights[i]/(t - _points[i]);
+ s1 = s1 + (v*_values[i]);
s2 = s2 + v;
}
else
{
double v = _weights[i];
- s1 = s1 + (v * _values[i]);
+ s1 = s1 + (v*_values[i]);
s2 = s2 + v;
}
}
- return s1 / s2;
+ return s1/s2;
}
///
@@ -242,4 +242,4 @@ namespace MathNet.Numerics.Interpolation.Algorithms
throw new NotSupportedException();
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Numerics/Interpolation/Algorithms/BulirschStoerRationalInterpolation.cs b/src/Numerics/Interpolation/BulirschStoerRationalInterpolation.cs
similarity index 94%
rename from src/Numerics/Interpolation/Algorithms/BulirschStoerRationalInterpolation.cs
rename to src/Numerics/Interpolation/BulirschStoerRationalInterpolation.cs
index bcfd4cec..832cef0b 100644
--- a/src/Numerics/Interpolation/Algorithms/BulirschStoerRationalInterpolation.cs
+++ b/src/Numerics/Interpolation/BulirschStoerRationalInterpolation.cs
@@ -28,11 +28,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
-namespace MathNet.Numerics.Interpolation.Algorithms
-{
- using System;
- using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
+namespace MathNet.Numerics.Interpolation
+{
///
/// Rational Interpolation (with poles) using Roland Bulirsch and Josef Stoer's Algorithm.
///
@@ -46,12 +46,12 @@ namespace MathNet.Numerics.Interpolation.Algorithms
///
/// Sample Points t.
///
- private IList _points;
+ IList _points;
///
/// Spline Values x(t).
///
- private IList _values;
+ IList _values;
///
/// Initializes a new instance of the BulirschStoerRationalInterpolation class.
@@ -165,7 +165,7 @@ namespace MathNet.Numerics.Interpolation.Algorithms
for (int i = 0; i < n - level; i++)
{
double hp = _points[i + level] - t;
- double ho = (_points[i] - t) * d[i] / hp;
+ double ho = (_points[i] - t)*d[i]/hp;
double den = ho - c[i + 1];
if (den.AlmostEqual(0.0))
@@ -173,12 +173,12 @@ namespace MathNet.Numerics.Interpolation.Algorithms
return double.NaN; // zero-div, singularity
}
- den = (c[i + 1] - d[i]) / den;
- d[i] = c[i + 1] * den;
- c[i] = ho * den;
+ den = (c[i + 1] - d[i])/den;
+ d[i] = c[i + 1]*den;
+ c[i] = ho*den;
}
- x += (2 * nearestIndex) < (n - level)
+ x += (2*nearestIndex) < (n - level)
? c[nearestIndex]
: d[--nearestIndex];
}
@@ -226,4 +226,4 @@ namespace MathNet.Numerics.Interpolation.Algorithms
throw new NotSupportedException();
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Numerics/Interpolation/Algorithms/CubicHermiteSplineInterpolation.cs b/src/Numerics/Interpolation/CubicHermiteSplineInterpolation.cs
similarity index 92%
rename from src/Numerics/Interpolation/Algorithms/CubicHermiteSplineInterpolation.cs
rename to src/Numerics/Interpolation/CubicHermiteSplineInterpolation.cs
index 8cae2a60..296158e4 100644
--- a/src/Numerics/Interpolation/Algorithms/CubicHermiteSplineInterpolation.cs
+++ b/src/Numerics/Interpolation/CubicHermiteSplineInterpolation.cs
@@ -28,12 +28,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
-namespace MathNet.Numerics.Interpolation.Algorithms
-{
- using System;
- using System.Collections.Generic;
- using Properties;
+using System;
+using System.Collections.Generic;
+using MathNet.Numerics.Properties;
+namespace MathNet.Numerics.Interpolation
+{
///
/// Cubic Hermite Spline Interpolation Algorithm.
///
@@ -45,7 +45,7 @@ namespace MathNet.Numerics.Interpolation.Algorithms
///
/// Internal Spline Interpolation
///
- private readonly SplineInterpolation _spline;
+ readonly SplineInterpolation _spline;
///
/// Initializes a new instance of the CubicHermiteSplineInterpolation class.
@@ -151,17 +151,17 @@ namespace MathNet.Numerics.Interpolation.Algorithms
if (samplePoints[i] <= samplePoints[i - 1])
throw new ArgumentException(Resources.Interpolation_Initialize_SamplePointsNotStrictlyAscendingOrder, "samplePoints");
- double[] coefficients = new double[4 * (samplePoints.Count - 1)];
+ double[] coefficients = new double[4*(samplePoints.Count - 1)];
for (int i = 0, j = 0; i < samplePoints.Count - 1; i++, j += 4)
{
double delta = samplePoints[i + 1] - samplePoints[i];
- double delta2 = delta * delta;
- double delta3 = delta * delta2;
+ double delta2 = delta*delta;
+ double delta3 = delta*delta2;
coefficients[j] = sampleValues[i];
coefficients[j + 1] = sampleDerivatives[i];
- coefficients[j + 2] = ((3 * (sampleValues[i + 1] - sampleValues[i])) - (2 * sampleDerivatives[i] * delta) - (sampleDerivatives[i + 1] * delta)) / delta2;
- coefficients[j + 3] = ((2 * (sampleValues[i] - sampleValues[i + 1])) + (sampleDerivatives[i] * delta) + (sampleDerivatives[i + 1] * delta)) / delta3;
+ coefficients[j + 2] = ((3*(sampleValues[i + 1] - sampleValues[i])) - (2*sampleDerivatives[i]*delta) - (sampleDerivatives[i + 1]*delta))/delta2;
+ coefficients[j + 3] = ((2*(sampleValues[i] - sampleValues[i + 1])) + (sampleDerivatives[i]*delta) + (sampleDerivatives[i + 1]*delta))/delta3;
}
return coefficients;
@@ -217,4 +217,4 @@ namespace MathNet.Numerics.Interpolation.Algorithms
return _spline.Integrate(t);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Numerics/Interpolation/Algorithms/CubicSplineInterpolation.cs b/src/Numerics/Interpolation/CubicSplineInterpolation.cs
similarity index 91%
rename from src/Numerics/Interpolation/Algorithms/CubicSplineInterpolation.cs
rename to src/Numerics/Interpolation/CubicSplineInterpolation.cs
index 85b5ecf8..987cf4a6 100644
--- a/src/Numerics/Interpolation/Algorithms/CubicSplineInterpolation.cs
+++ b/src/Numerics/Interpolation/CubicSplineInterpolation.cs
@@ -28,12 +28,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
-namespace MathNet.Numerics.Interpolation.Algorithms
-{
- using System;
- using System.Collections.Generic;
- using Properties;
+using System;
+using System.Collections.Generic;
+using MathNet.Numerics.Properties;
+namespace MathNet.Numerics.Interpolation
+{
///
/// Cubic Spline Interpolation Algorithm with continuous first and second derivatives.
///
@@ -45,7 +45,7 @@ namespace MathNet.Numerics.Interpolation.Algorithms
///
/// Internal Spline Interpolation
///
- private readonly CubicHermiteSplineInterpolation _spline;
+ readonly CubicHermiteSplineInterpolation _spline;
///
/// Initializes a new instance of the CubicSplineInterpolation class.
@@ -246,7 +246,7 @@ namespace MathNet.Numerics.Interpolation.Algorithms
a1[0] = 0;
a2[0] = 1;
a3[0] = 1;
- b[0] = 2 * (sampleValues[1] - sampleValues[0]) / (samplePoints[1] - samplePoints[0]);
+ b[0] = 2*(sampleValues[1] - sampleValues[0])/(samplePoints[1] - samplePoints[0]);
break;
case SplineBoundaryCondition.FirstDerivative:
a1[0] = 0;
@@ -258,7 +258,7 @@ namespace MathNet.Numerics.Interpolation.Algorithms
a1[0] = 0;
a2[0] = 2;
a3[0] = 1;
- b[0] = (3 * ((sampleValues[1] - sampleValues[0]) / (samplePoints[1] - samplePoints[0]))) - (0.5 * leftBoundary * (samplePoints[1] - samplePoints[0]));
+ b[0] = (3*((sampleValues[1] - sampleValues[0])/(samplePoints[1] - samplePoints[0]))) - (0.5*leftBoundary*(samplePoints[1] - samplePoints[0]));
break;
default:
throw new NotSupportedException(Resources.InvalidLeftBoundaryCondition);
@@ -268,9 +268,9 @@ namespace MathNet.Numerics.Interpolation.Algorithms
for (int i = 1; i < samplePoints.Count - 1; i++)
{
a1[i] = samplePoints[i + 1] - samplePoints[i];
- a2[i] = 2 * (samplePoints[i + 1] - samplePoints[i - 1]);
+ a2[i] = 2*(samplePoints[i + 1] - samplePoints[i - 1]);
a3[i] = samplePoints[i] - samplePoints[i - 1];
- b[i] = (3 * (sampleValues[i] - sampleValues[i - 1]) / (samplePoints[i] - samplePoints[i - 1]) * (samplePoints[i + 1] - samplePoints[i])) + (3 * (sampleValues[i + 1] - sampleValues[i]) / (samplePoints[i + 1] - samplePoints[i]) * (samplePoints[i] - samplePoints[i - 1]));
+ b[i] = (3*(sampleValues[i] - sampleValues[i - 1])/(samplePoints[i] - samplePoints[i - 1])*(samplePoints[i + 1] - samplePoints[i])) + (3*(sampleValues[i + 1] - sampleValues[i])/(samplePoints[i + 1] - samplePoints[i])*(samplePoints[i] - samplePoints[i - 1]));
}
// Right Boundary
@@ -280,7 +280,7 @@ namespace MathNet.Numerics.Interpolation.Algorithms
a1[n - 1] = 1;
a2[n - 1] = 1;
a3[n - 1] = 0;
- b[n - 1] = 2 * (sampleValues[n - 1] - sampleValues[n - 2]) / (samplePoints[n - 1] - samplePoints[n - 2]);
+ b[n - 1] = 2*(sampleValues[n - 1] - sampleValues[n - 2])/(samplePoints[n - 1] - samplePoints[n - 2]);
break;
case SplineBoundaryCondition.FirstDerivative:
a1[n - 1] = 0;
@@ -292,7 +292,7 @@ namespace MathNet.Numerics.Interpolation.Algorithms
a1[n - 1] = 1;
a2[n - 1] = 2;
a3[n - 1] = 0;
- b[n - 1] = (3 * (sampleValues[n - 1] - sampleValues[n - 2]) / (samplePoints[n - 1] - samplePoints[n - 2])) + (0.5 * rightBoundary * (samplePoints[n - 1] - samplePoints[n - 2]));
+ b[n - 1] = (3*(sampleValues[n - 1] - sampleValues[n - 2])/(samplePoints[n - 1] - samplePoints[n - 2])) + (0.5*rightBoundary*(samplePoints[n - 1] - samplePoints[n - 2]));
break;
default:
throw new NotSupportedException(Resources.InvalidRightBoundaryCondition);
@@ -343,7 +343,7 @@ namespace MathNet.Numerics.Interpolation.Algorithms
/// The c-vector[n].
/// The d-vector[n], will be modified by this function.
/// The x-vector[n]
- private static double[] SolveTridiagonal(
+ static double[] SolveTridiagonal(
double[] a,
double[] b,
double[] c,
@@ -353,15 +353,15 @@ namespace MathNet.Numerics.Interpolation.Algorithms
for (int k = 1; k < a.Length; k++)
{
- double t = a[k] / b[k - 1];
- b[k] = b[k] - (t * c[k - 1]);
- d[k] = d[k] - (t * d[k - 1]);
+ double t = a[k]/b[k - 1];
+ b[k] = b[k] - (t*c[k - 1]);
+ d[k] = d[k] - (t*d[k - 1]);
}
- x[x.Length - 1] = d[d.Length - 1] / b[b.Length - 1];
+ x[x.Length - 1] = d[d.Length - 1]/b[b.Length - 1];
for (int k = x.Length - 2; k >= 0; k--)
{
- x[k] = (d[k] - (c[k] * x[k + 1])) / b[k];
+ x[k] = (d[k] - (c[k]*x[k + 1]))/b[k];
}
return x;
@@ -417,4 +417,4 @@ namespace MathNet.Numerics.Interpolation.Algorithms
return _spline.Integrate(t);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Numerics/Interpolation/Algorithms/EquidistantPolynomialInterpolation.cs b/src/Numerics/Interpolation/EquidistantPolynomialInterpolation.cs
similarity index 96%
rename from src/Numerics/Interpolation/Algorithms/EquidistantPolynomialInterpolation.cs
rename to src/Numerics/Interpolation/EquidistantPolynomialInterpolation.cs
index fcd5069c..0a3bceb0 100644
--- a/src/Numerics/Interpolation/Algorithms/EquidistantPolynomialInterpolation.cs
+++ b/src/Numerics/Interpolation/EquidistantPolynomialInterpolation.cs
@@ -28,11 +28,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
-namespace MathNet.Numerics.Interpolation.Algorithms
-{
- using System;
- using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
+namespace MathNet.Numerics.Interpolation
+{
///
/// Barycentric Polynomial Interpolation where the given sample points are equidistant.
///
@@ -44,7 +44,7 @@ namespace MathNet.Numerics.Interpolation.Algorithms
///
/// Internal Barycentric Interpolation
///
- private readonly BarycentricInterpolation _barycentric;
+ readonly BarycentricInterpolation _barycentric;
///
/// Initializes a new instance of the EquidistantPolynomialInterpolation class.
@@ -124,7 +124,7 @@ namespace MathNet.Numerics.Interpolation.Algorithms
var samplePoints = new double[sampleValues.Count];
samplePoints[0] = leftBound;
- double step = (rightBound - leftBound) / (samplePoints.Length - 1);
+ double step = (rightBound - leftBound)/(samplePoints.Length - 1);
for (int i = 1; i < samplePoints.Length; i++)
{
samplePoints[i] = samplePoints[i - 1] + step;
@@ -172,7 +172,7 @@ namespace MathNet.Numerics.Interpolation.Algorithms
weights[0] = 1.0;
for (int i = 1; i < weights.Length; i++)
{
- weights[i] = -(weights[i - 1] * (weights.Length - i)) / i;
+ weights[i] = -(weights[i - 1]*(weights.Length - i))/i;
}
return weights;
diff --git a/src/Numerics/Interpolation/Algorithms/FloaterHormannRationalInterpolation.cs b/src/Numerics/Interpolation/FloaterHormannRationalInterpolation.cs
similarity index 97%
rename from src/Numerics/Interpolation/Algorithms/FloaterHormannRationalInterpolation.cs
rename to src/Numerics/Interpolation/FloaterHormannRationalInterpolation.cs
index 8604bcc2..c8350ded 100644
--- a/src/Numerics/Interpolation/Algorithms/FloaterHormannRationalInterpolation.cs
+++ b/src/Numerics/Interpolation/FloaterHormannRationalInterpolation.cs
@@ -28,11 +28,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
-namespace MathNet.Numerics.Interpolation.Algorithms
-{
- using System;
- using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
+namespace MathNet.Numerics.Interpolation
+{
///
/// Barycentric Rational Interpolation without poles, using Mike Floater and Kai Hormann's Algorithm.
///
@@ -44,7 +44,7 @@ namespace MathNet.Numerics.Interpolation.Algorithms
///
/// Internal Barycentric Interpolation
///
- private readonly BarycentricInterpolation _barycentric;
+ readonly BarycentricInterpolation _barycentric;
///
/// Initializes a new instance of the FloaterHormannRationalInterpolation class.
@@ -234,14 +234,14 @@ namespace MathNet.Numerics.Interpolation.Algorithms
{
if (j != k)
{
- v = v / Math.Abs(sortedPoints[k] - sortedPoints[j]);
+ v = v/Math.Abs(sortedPoints[k] - sortedPoints[j]);
}
}
s = s + v;
}
- sortedWeights[k] = sign * s;
+ sortedWeights[k] = sign*s;
sign = -sign;
}
@@ -305,4 +305,4 @@ namespace MathNet.Numerics.Interpolation.Algorithms
throw new NotSupportedException();
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Numerics/Interpolation/IInterpolation.cs b/src/Numerics/Interpolation/IInterpolation.cs
index 1acf3ac4..2acd9589 100644
--- a/src/Numerics/Interpolation/IInterpolation.cs
+++ b/src/Numerics/Interpolation/IInterpolation.cs
@@ -86,4 +86,4 @@ namespace MathNet.Numerics.Interpolation
///
double Integrate(double t);
}
-}
\ No newline at end of file
+}
diff --git a/src/Numerics/Interpolation/Algorithms/LinearSplineInterpolation.cs b/src/Numerics/Interpolation/LinearSplineInterpolation.cs
similarity index 95%
rename from src/Numerics/Interpolation/Algorithms/LinearSplineInterpolation.cs
rename to src/Numerics/Interpolation/LinearSplineInterpolation.cs
index 46b27c26..adf0f08d 100644
--- a/src/Numerics/Interpolation/Algorithms/LinearSplineInterpolation.cs
+++ b/src/Numerics/Interpolation/LinearSplineInterpolation.cs
@@ -28,12 +28,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
-namespace MathNet.Numerics.Interpolation.Algorithms
-{
- using System;
- using System.Collections.Generic;
- using Properties;
+using System;
+using System.Collections.Generic;
+using MathNet.Numerics.Properties;
+namespace MathNet.Numerics.Interpolation
+{
///
/// Linear Spline Interpolation Algorithm.
///
@@ -45,7 +45,7 @@ namespace MathNet.Numerics.Interpolation.Algorithms
///
/// Internal Spline Interpolation
///
- private readonly SplineInterpolation _spline;
+ readonly SplineInterpolation _spline;
///
/// Initializes a new instance of the LinearSplineInterpolation class.
@@ -138,12 +138,12 @@ namespace MathNet.Numerics.Interpolation.Algorithms
if (samplePoints[i] <= samplePoints[i - 1])
throw new ArgumentException(Resources.Interpolation_Initialize_SamplePointsNotStrictlyAscendingOrder, "samplePoints");
- double[] coefficients = new double[4 * (samplePoints.Count - 1)];
+ double[] coefficients = new double[4*(samplePoints.Count - 1)];
for (int i = 0, j = 0; i < samplePoints.Count - 1; i++, j += 4)
{
coefficients[j] = sampleValues[i];
- coefficients[j + 1] = (sampleValues[i + 1] - sampleValues[i]) / (samplePoints[i + 1] - samplePoints[i]);
+ coefficients[j + 1] = (sampleValues[i + 1] - sampleValues[i])/(samplePoints[i + 1] - samplePoints[i]);
coefficients[j + 2] = 0;
coefficients[j + 3] = 0;
}
@@ -201,4 +201,4 @@ namespace MathNet.Numerics.Interpolation.Algorithms
return _spline.Integrate(t);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Numerics/Interpolation/Algorithms/NevillePolynomialInterpolation.cs b/src/Numerics/Interpolation/NevillePolynomialInterpolation.cs
similarity index 92%
rename from src/Numerics/Interpolation/Algorithms/NevillePolynomialInterpolation.cs
rename to src/Numerics/Interpolation/NevillePolynomialInterpolation.cs
index 6b48a615..315ee81b 100644
--- a/src/Numerics/Interpolation/Algorithms/NevillePolynomialInterpolation.cs
+++ b/src/Numerics/Interpolation/NevillePolynomialInterpolation.cs
@@ -28,12 +28,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
-namespace MathNet.Numerics.Interpolation.Algorithms
-{
- using System;
- using System.Collections.Generic;
- using Properties;
+using System;
+using System.Collections.Generic;
+using MathNet.Numerics.Properties;
+namespace MathNet.Numerics.Interpolation
+{
///
/// Lagrange Polynomial Interpolation using Neville's Algorithm.
///
@@ -52,12 +52,12 @@ namespace MathNet.Numerics.Interpolation.Algorithms
///
/// Sample Points t.
///
- private IList _points;
+ IList _points;
///
/// Spline Values x(t).
///
- private IList _values;
+ IList _values;
///
/// Initializes a new instance of the NevillePolynomialInterpolation class.
@@ -151,7 +151,7 @@ namespace MathNet.Numerics.Interpolation.Algorithms
double hp = t - _points[i + level];
double ho = _points[i] - t;
double den = _points[i] - _points[i + level];
- x[i] = ((hp * x[i]) + (ho * x[i + 1])) / den;
+ x[i] = ((hp*x[i]) + (ho*x[i + 1]))/den;
}
}
@@ -178,8 +178,8 @@ namespace MathNet.Numerics.Interpolation.Algorithms
double hp = t - _points[i + level];
double ho = _points[i] - t;
double den = _points[i] - _points[i + level];
- dx[i] = ((hp * dx[i]) + x[i] + (ho * dx[i + 1]) - x[i + 1]) / den;
- x[i] = ((hp * x[i]) + (ho * x[i + 1])) / den;
+ dx[i] = ((hp*dx[i]) + x[i] + (ho*dx[i + 1]) - x[i + 1])/den;
+ x[i] = ((hp*x[i]) + (ho*x[i + 1]))/den;
}
}
@@ -212,9 +212,9 @@ namespace MathNet.Numerics.Interpolation.Algorithms
double hp = t - _points[i + level];
double ho = _points[i] - t;
double den = _points[i] - _points[i + level];
- ddx[i] = ((hp * ddx[i]) + (ho * ddx[i + 1]) + (2 * dx[i]) - (2 * dx[i + 1])) / den;
- dx[i] = ((hp * dx[i]) + x[i] + (ho * dx[i + 1]) - x[i + 1]) / den;
- x[i] = ((hp * x[i]) + (ho * x[i + 1])) / den;
+ ddx[i] = ((hp*ddx[i]) + (ho*ddx[i + 1]) + (2*dx[i]) - (2*dx[i + 1]))/den;
+ dx[i] = ((hp*dx[i]) + x[i] + (ho*dx[i + 1]) - x[i + 1])/den;
+ x[i] = ((hp*x[i]) + (ho*x[i + 1]))/den;
}
}
@@ -234,4 +234,4 @@ namespace MathNet.Numerics.Interpolation.Algorithms
throw new NotSupportedException();
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Numerics/Interpolation/SplineBoundaryCondition.cs b/src/Numerics/Interpolation/SplineBoundaryCondition.cs
index a5415732..75db7223 100644
--- a/src/Numerics/Interpolation/SplineBoundaryCondition.cs
+++ b/src/Numerics/Interpolation/SplineBoundaryCondition.cs
@@ -55,4 +55,4 @@ namespace MathNet.Numerics.Interpolation
///
SecondDerivative
}
-}
\ No newline at end of file
+}
diff --git a/src/Numerics/Interpolation/Algorithms/SplineInterpolation.cs b/src/Numerics/Interpolation/SplineInterpolation.cs
similarity index 81%
rename from src/Numerics/Interpolation/Algorithms/SplineInterpolation.cs
rename to src/Numerics/Interpolation/SplineInterpolation.cs
index c654b21f..ff0d694d 100644
--- a/src/Numerics/Interpolation/Algorithms/SplineInterpolation.cs
+++ b/src/Numerics/Interpolation/SplineInterpolation.cs
@@ -28,12 +28,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
-namespace MathNet.Numerics.Interpolation.Algorithms
-{
- using System;
- using System.Collections.Generic;
- using Properties;
+using System;
+using System.Collections.Generic;
+using MathNet.Numerics.Properties;
+namespace MathNet.Numerics.Interpolation
+{
///
/// Third-Degree Spline Interpolation Algorithm.
///
@@ -45,17 +45,17 @@ namespace MathNet.Numerics.Interpolation.Algorithms
///
/// Sample Points t.
///
- private IList _points;
+ IList _points;
///
/// Spline Coefficients c(t).
///
- private IList _coefficients;
+ IList _coefficients;
///
/// Number of samples.
///
- private int _sampleCount;
+ int _sampleCount;
///
/// Initializes a new instance of the SplineInterpolation class.
@@ -119,7 +119,7 @@ namespace MathNet.Numerics.Interpolation.Algorithms
throw new ArgumentOutOfRangeException("samplePoints");
}
- if (splineCoefficients.Count != 4 * (samplePoints.Count - 1))
+ if (splineCoefficients.Count != 4*(samplePoints.Count - 1))
{
throw new ArgumentOutOfRangeException("splineCoefficients");
}
@@ -147,9 +147,9 @@ namespace MathNet.Numerics.Interpolation.Algorithms
int k = closestLeftIndex << 2;
return _coefficients[k]
- + (offset * (_coefficients[k + 1]
- + (offset * (_coefficients[k + 2]
- + (offset * _coefficients[k + 3])))));
+ + (offset*(_coefficients[k + 1]
+ + (offset*(_coefficients[k + 2]
+ + (offset*_coefficients[k + 3])))));
}
///
@@ -168,8 +168,8 @@ namespace MathNet.Numerics.Interpolation.Algorithms
int k = closestLeftIndex << 2;
return _coefficients[k + 1]
- + (2 * offset * _coefficients[k + 2])
- + (3 * offset * offset * _coefficients[k + 3]);
+ + (2*offset*_coefficients[k + 2])
+ + (3*offset*offset*_coefficients[k + 3]);
}
///
@@ -193,16 +193,16 @@ namespace MathNet.Numerics.Interpolation.Algorithms
int k = closestLeftIndex << 2;
interpolatedValue = _coefficients[k]
- + (offset * (_coefficients[k + 1]
- + (offset * (_coefficients[k + 2]
- + (offset * _coefficients[k + 3])))));
+ + (offset*(_coefficients[k + 1]
+ + (offset*(_coefficients[k + 2]
+ + (offset*_coefficients[k + 3])))));
- secondDerivative = (2 * _coefficients[k + 2])
- + (6 * offset * _coefficients[k + 3]);
+ secondDerivative = (2*_coefficients[k + 2])
+ + (6*offset*_coefficients[k + 3]);
return _coefficients[k + 1]
- + (2 * offset * _coefficients[k + 2])
- + (3 * offset * offset * _coefficients[k + 3]);
+ + (2*offset*_coefficients[k + 2])
+ + (3*offset*offset*_coefficients[k + 3]);
}
///
@@ -220,19 +220,19 @@ namespace MathNet.Numerics.Interpolation.Algorithms
for (int i = 0, j = 0; i < closestLeftIndex; i++, j += 4)
{
double w = _points[i + 1] - _points[i];
- result += w * (_coefficients[j]
- + ((w * _coefficients[j + 1] * 0.5)
- + (w * ((_coefficients[j + 2] / 3)
- + (w * _coefficients[j + 3] * 0.25)))));
+ result += w*(_coefficients[j]
+ + ((w*_coefficients[j + 1]*0.5)
+ + (w*((_coefficients[j + 2]/3)
+ + (w*_coefficients[j + 3]*0.25)))));
}
double offset = t - _points[closestLeftIndex];
int k = closestLeftIndex << 2;
- return result + (offset * (_coefficients[k]
- + (offset * _coefficients[k + 1] * 0.5)
- + (offset * _coefficients[k + 2] / 3)
- + (offset * _coefficients[k + 3] * 0.25)));
+ return result + (offset*(_coefficients[k]
+ + (offset*_coefficients[k + 1]*0.5)
+ + (offset*_coefficients[k + 2]/3)
+ + (offset*_coefficients[k + 3]*0.25)));
}
///
@@ -240,14 +240,14 @@ namespace MathNet.Numerics.Interpolation.Algorithms
///
/// The value to look for.
/// The sample point index.
- private int IndexOfClosestPointLeftOf(double t)
+ int IndexOfClosestPointLeftOf(double t)
{
// Binary search in the [ t[0], ..., t[n-2] ] (t[n-1] is not included)
int low = 0;
int high = _sampleCount - 1;
while (low != high - 1)
{
- int middle = (low + high) / 2;
+ int middle = (low + high)/2;
if (_points[middle] > t)
{
high = middle;
@@ -261,4 +261,4 @@ namespace MathNet.Numerics.Interpolation.Algorithms
return low;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Numerics/Numerics.csproj b/src/Numerics/Numerics.csproj
index 44711a7a..a333bc40 100644
--- a/src/Numerics/Numerics.csproj
+++ b/src/Numerics/Numerics.csproj
@@ -384,7 +384,7 @@
-
+
@@ -396,17 +396,17 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
diff --git a/src/UnitTests/InterpolationTests/AkimaSplineTest.cs b/src/UnitTests/InterpolationTests/AkimaSplineTest.cs
index 127dc2c5..e70d7c03 100644
--- a/src/UnitTests/InterpolationTests/AkimaSplineTest.cs
+++ b/src/UnitTests/InterpolationTests/AkimaSplineTest.cs
@@ -31,7 +31,6 @@
namespace MathNet.Numerics.UnitTests.InterpolationTests
{
using Interpolation;
- using Interpolation.Algorithms;
using NUnit.Framework;
///
diff --git a/src/UnitTests/InterpolationTests/BulirschStoerRationalTest.cs b/src/UnitTests/InterpolationTests/BulirschStoerRationalTest.cs
index 1d8c0a6d..688328c2 100644
--- a/src/UnitTests/InterpolationTests/BulirschStoerRationalTest.cs
+++ b/src/UnitTests/InterpolationTests/BulirschStoerRationalTest.cs
@@ -31,7 +31,6 @@
namespace MathNet.Numerics.UnitTests.InterpolationTests
{
using Interpolation;
- using Interpolation.Algorithms;
using NUnit.Framework;
///
diff --git a/src/UnitTests/InterpolationTests/CubicSplineTest.cs b/src/UnitTests/InterpolationTests/CubicSplineTest.cs
index ccaa1894..fcab0bdb 100644
--- a/src/UnitTests/InterpolationTests/CubicSplineTest.cs
+++ b/src/UnitTests/InterpolationTests/CubicSplineTest.cs
@@ -35,7 +35,6 @@ namespace MathNet.Numerics.UnitTests.InterpolationTests
using System.IO;
using System.Linq;
using Interpolation;
- using Interpolation.Algorithms;
using NUnit.Framework;
///
diff --git a/src/UnitTests/InterpolationTests/EquidistantPolynomialTest.cs b/src/UnitTests/InterpolationTests/EquidistantPolynomialTest.cs
index d4ff51ea..ba9b053b 100644
--- a/src/UnitTests/InterpolationTests/EquidistantPolynomialTest.cs
+++ b/src/UnitTests/InterpolationTests/EquidistantPolynomialTest.cs
@@ -31,7 +31,6 @@
namespace MathNet.Numerics.UnitTests.InterpolationTests
{
using Interpolation;
- using Interpolation.Algorithms;
using NUnit.Framework;
///
diff --git a/src/UnitTests/InterpolationTests/FloaterHormannRationalTest.cs b/src/UnitTests/InterpolationTests/FloaterHormannRationalTest.cs
index 7681e926..fd8e365e 100644
--- a/src/UnitTests/InterpolationTests/FloaterHormannRationalTest.cs
+++ b/src/UnitTests/InterpolationTests/FloaterHormannRationalTest.cs
@@ -31,7 +31,6 @@
namespace MathNet.Numerics.UnitTests.InterpolationTests
{
using Interpolation;
- using Interpolation.Algorithms;
using NUnit.Framework;
///
diff --git a/src/UnitTests/InterpolationTests/LinearSplineTest.cs b/src/UnitTests/InterpolationTests/LinearSplineTest.cs
index dba3da9b..62d119bb 100644
--- a/src/UnitTests/InterpolationTests/LinearSplineTest.cs
+++ b/src/UnitTests/InterpolationTests/LinearSplineTest.cs
@@ -35,7 +35,6 @@ namespace MathNet.Numerics.UnitTests.InterpolationTests
using System.IO;
using System.Linq;
using Interpolation;
- using Interpolation.Algorithms;
using NUnit.Framework;
///
diff --git a/src/UnitTests/InterpolationTests/NevillePolynomialTest.cs b/src/UnitTests/InterpolationTests/NevillePolynomialTest.cs
index 533ef58a..c328dc2d 100644
--- a/src/UnitTests/InterpolationTests/NevillePolynomialTest.cs
+++ b/src/UnitTests/InterpolationTests/NevillePolynomialTest.cs
@@ -35,7 +35,6 @@ namespace MathNet.Numerics.UnitTests.InterpolationTests
using System.IO;
using System.Linq;
using Interpolation;
- using Interpolation.Algorithms;
using NUnit.Framework;
///