Browse Source

RootFinding: simplify namespaces

v2
Christoph Ruegg 13 years ago
parent
commit
c12a648197
  1. 8
      src/Numerics/FindRoots.cs
  2. 10
      src/Numerics/Numerics.csproj
  3. 2
      src/Numerics/RootFinding/Bisection.cs
  4. 2
      src/Numerics/RootFinding/Brent.cs
  5. 2
      src/Numerics/RootFinding/HybridNewtonRaphson.cs
  6. 2
      src/Numerics/RootFinding/ZeroCrossingBracketing.cs
  7. 22
      src/Portable/Portable.csproj
  8. 2
      src/UnitTests/RootFindingTests/BisectionTest.cs
  9. 2
      src/UnitTests/RootFindingTests/BrentTest.cs
  10. 5
      src/UnitTests/RootFindingTests/NewtonRaphsonTest.cs

8
src/Numerics/RootFinding/RealRoots.cs → src/Numerics/FindRoots.cs

@ -1,4 +1,4 @@
// <copyright file="FloatingPointRoots.cs" company="Math.NET">
// <copyright file="FindRoots.cs" company="Math.NET">
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
@ -29,11 +29,11 @@
// </copyright>
using System;
using MathNet.Numerics.RootFinding.Algorithms;
using MathNet.Numerics.RootFinding;
namespace MathNet.Numerics.RootFinding
namespace MathNet.Numerics
{
public static class RealRoots
public static class FindRoots
{
public static double OfFunction(Func<double, double> f, double lowerBound, double upperBound, double accuracy = 1e-8)
{

10
src/Numerics/Numerics.csproj

@ -111,11 +111,11 @@
<Compile Include="LinearAlgebra\Generic\Matrix.BCL.cs" />
<Compile Include="LinearAlgebra\Generic\Vector.BCL.cs" />
<Compile Include="NonConvergenceException.cs" />
<Compile Include="RootFinding\Algorithms\HybridNewtonRaphson.cs" />
<Compile Include="RootFinding\Algorithms\ZeroCrossingBracketing.cs" />
<Compile Include="RootFinding\Algorithms\Brent.cs" />
<Compile Include="RootFinding\RealRoots.cs" />
<Compile Include="RootFinding\Algorithms\Bisection.cs" />
<Compile Include="RootFinding\HybridNewtonRaphson.cs" />
<Compile Include="RootFinding\ZeroCrossingBracketing.cs" />
<Compile Include="RootFinding\Brent.cs" />
<Compile Include="FindRoots.cs" />
<Compile Include="RootFinding\Bisection.cs" />
<Compile Include="SpecialFunctions\Evaluate.cs" />
<Compile Include="SpecialFunctions\ModifiedStruve.cs" />
<Compile Include="SpecialFunctions\ModifiedBessel.cs" />

2
src/Numerics/RootFinding/Algorithms/Bisection.cs → src/Numerics/RootFinding/Bisection.cs

@ -31,7 +31,7 @@
using System;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.RootFinding.Algorithms
namespace MathNet.Numerics.RootFinding
{
public static class Bisection
{

2
src/Numerics/RootFinding/Algorithms/Brent.cs → src/Numerics/RootFinding/Brent.cs

@ -30,7 +30,7 @@
using System;
namespace MathNet.Numerics.RootFinding.Algorithms
namespace MathNet.Numerics.RootFinding
{
public static class Brent
{

2
src/Numerics/RootFinding/Algorithms/HybridNewtonRaphson.cs → src/Numerics/RootFinding/HybridNewtonRaphson.cs

@ -30,7 +30,7 @@
using System;
namespace MathNet.Numerics.RootFinding.Algorithms
namespace MathNet.Numerics.RootFinding
{
public static class HybridNewtonRaphson
{

2
src/Numerics/RootFinding/Algorithms/ZeroCrossingBracketing.cs → src/Numerics/RootFinding/ZeroCrossingBracketing.cs

@ -32,7 +32,7 @@ using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.RootFinding.Algorithms
namespace MathNet.Numerics.RootFinding
{
public static class ZeroCrossingBracketing
{

22
src/Portable/Portable.csproj

@ -198,6 +198,9 @@
<Compile Include="..\Numerics\Financial\AbsoluteRiskMeasures.cs">
<Link>Financial\AbsoluteRiskMeasures.cs</Link>
</Compile>
<Compile Include="..\Numerics\FindRoots.cs">
<Link>FindRoots.cs</Link>
</Compile>
<Compile Include="..\Numerics\Fit.cs">
<Link>Fit.cs</Link>
</Compile>
@ -987,20 +990,17 @@
<Compile Include="..\Numerics\Random\Xorshift.cs">
<Link>Random\Xorshift.cs</Link>
</Compile>
<Compile Include="..\Numerics\RootFinding\Algorithms\Bisection.cs">
<Link>RootFinding\Algorithms\Bisection.cs</Link>
</Compile>
<Compile Include="..\Numerics\RootFinding\Algorithms\Brent.cs">
<Link>RootFinding\Algorithms\Brent.cs</Link>
<Compile Include="..\Numerics\RootFinding\Bisection.cs">
<Link>RootFinding\Bisection.cs</Link>
</Compile>
<Compile Include="..\Numerics\RootFinding\Algorithms\HybridNewtonRaphson.cs">
<Link>RootFinding\Algorithms\HybridNewtonRaphson.cs</Link>
<Compile Include="..\Numerics\RootFinding\Brent.cs">
<Link>RootFinding\Brent.cs</Link>
</Compile>
<Compile Include="..\Numerics\RootFinding\Algorithms\ZeroCrossingBracketing.cs">
<Link>RootFinding\Algorithms\ZeroCrossingBracketing.cs</Link>
<Compile Include="..\Numerics\RootFinding\HybridNewtonRaphson.cs">
<Link>RootFinding\HybridNewtonRaphson.cs</Link>
</Compile>
<Compile Include="..\Numerics\RootFinding\RealRoots.cs">
<Link>RootFinding\RealRoots.cs</Link>
<Compile Include="..\Numerics\RootFinding\ZeroCrossingBracketing.cs">
<Link>RootFinding\ZeroCrossingBracketing.cs</Link>
</Compile>
<Compile Include="..\Numerics\SerializableAttribute.cs">
<Link>SerializableAttribute.cs</Link>

2
src/UnitTests/RootFindingTests/BisectionTest.cs

@ -29,7 +29,7 @@
// </copyright>
using System;
using MathNet.Numerics.RootFinding.Algorithms;
using MathNet.Numerics.RootFinding;
using NUnit.Framework;
namespace MathNet.Numerics.UnitTests.RootFindingTests

2
src/UnitTests/RootFindingTests/BrentTest.cs

@ -29,7 +29,7 @@
// </copyright>
using System;
using MathNet.Numerics.RootFinding.Algorithms;
using MathNet.Numerics.RootFinding;
using NUnit.Framework;
namespace MathNet.Numerics.UnitTests.RootFindingTests

5
src/UnitTests/RootFindingTests/NewtonRaphsonTest.cs

@ -30,7 +30,6 @@
using System;
using MathNet.Numerics.RootFinding;
using MathNet.Numerics.RootFinding.Algorithms;
using NUnit.Framework;
namespace MathNet.Numerics.UnitTests.RootFindingTests
@ -77,13 +76,13 @@ namespace MathNet.Numerics.UnitTests.RootFindingTests
Func<double, double> df1 = x => -1/(x*x - 4*x + 4);
Assert.AreEqual(1.5, HybridNewtonRaphson.FindRoot(f1, df1, 1, 2, 1e-14, 100, 20));
Assert.AreEqual(1.5, HybridNewtonRaphson.FindRoot(f1, df1, 1, 6, 1e-14, 100, 20));
Assert.AreEqual(1.5, RealRoots.OfFunctionAndDerivative(f1, df1, 1, 6));
Assert.AreEqual(1.5, FindRoots.OfFunctionAndDerivative(f1, df1, 1, 6));
Func<double, double> f2 = x => -1/(x - 2) + 2;
Func<double, double> df2 = x => 1/(x*x - 4*x + 4);
Assert.AreEqual(2.5, HybridNewtonRaphson.FindRoot(f2, df2, 2, 3, 1e-14, 100, 20));
Assert.AreEqual(2.5, HybridNewtonRaphson.FindRoot(f2, df2, -2, 3, 1e-14, 100, 20));
Assert.AreEqual(2.5, RealRoots.OfFunctionAndDerivative(f2, df2, -2, 3));
Assert.AreEqual(2.5, FindRoots.OfFunctionAndDerivative(f2, df2, -2, 3));
Func<double, double> f3 = x => 1/(x - 2) + x + 2;
Func<double, double> df3 = x => -1/(x*x - 4*x + 4) + 1;

Loading…
Cancel
Save