diff --git a/.gitignore b/.gitignore
index f5a717ff..48c268cd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@ bin
out
Thumbs.db
TestResult.xml
+TestResults
coverage.*
_ReSharper*
*.ReSharper
diff --git a/MathNet.Numerics.snl.DotSettings b/MathNet.Numerics.Portable.sln.DotSettings
similarity index 96%
rename from MathNet.Numerics.snl.DotSettings
rename to MathNet.Numerics.Portable.sln.DotSettings
index e872f619..1cf7b657 100644
--- a/MathNet.Numerics.snl.DotSettings
+++ b/MathNet.Numerics.Portable.sln.DotSettings
@@ -12,9 +12,4 @@
False
True
True
- False
-
-
-
-
-
\ No newline at end of file
+ False
\ No newline at end of file
diff --git a/MathNet.Numerics.sln.DotSettings b/MathNet.Numerics.sln.DotSettings
new file mode 100644
index 00000000..1cf7b657
--- /dev/null
+++ b/MathNet.Numerics.sln.DotSettings
@@ -0,0 +1,15 @@
+
+ False
+ False
+ False
+ False
+ False
+ False
+ False
+ False
+ False
+ False
+ False
+ True
+ True
+ False
\ No newline at end of file
diff --git a/src/UnitTests/ComplexTests/Complex32Test.TextHandling.cs b/src/UnitTests/ComplexTests/Complex32Test.TextHandling.cs
index 50603b9e..19e55c39 100644
--- a/src/UnitTests/ComplexTests/Complex32Test.TextHandling.cs
+++ b/src/UnitTests/ComplexTests/Complex32Test.TextHandling.cs
@@ -78,14 +78,17 @@ namespace MathNet.Numerics.UnitTests.ComplexTests
/// Not a number name.
/// Infinity name.
/// Complex Number.
- [TestCase("en-US", "NaN", "Infinity", "1.1")]
- [TestCase("tr-TR", "NaN", "Infinity", "1,1")]
- [TestCase("de-DE", "n. def.", "+unendlich", "1,1")]
- [TestCase("de-CH", "n. def.", "+unendlich", "1.1")]
- [TestCase("he-IL", "לא מספר", "אינסוף חיובי", "1.1")]
- public void CanFormatComplexToStringWithCulture(string cultureName, string nan, string infinity, string number)
+ [TestCase("en-US", "1.1")]
+ [TestCase("tr-TR", "1,1")]
+ [TestCase("de-DE", "1,1")]
+ [TestCase("de-CH", "1.1")]
+ [TestCase("he-IL", "1.1")]
+ public void CanFormatComplexToStringWithCulture(string cultureName, string number)
{
var provider = new CultureInfo(cultureName);
+ var nan = double.NaN.ToString(provider);
+ var infinity = double.PositiveInfinity.ToString(provider);
+
Assert.AreEqual("(" + nan + ", " + nan + ")", Complex32.NaN.ToString(provider));
Assert.AreEqual("(" + infinity + ", " + infinity + ")", Complex32.Infinity.ToString(provider));
Assert.AreEqual("(0, 0)", Complex32.Zero.ToString(provider));
diff --git a/src/UnitTests/LinearAlgebraProviderTests/Complex/LinearAlgebraProviderTests.cs b/src/UnitTests/LinearAlgebraProviderTests/Complex/LinearAlgebraProviderTests.cs
index 8d431820..2d4c3a81 100644
--- a/src/UnitTests/LinearAlgebraProviderTests/Complex/LinearAlgebraProviderTests.cs
+++ b/src/UnitTests/LinearAlgebraProviderTests/Complex/LinearAlgebraProviderTests.cs
@@ -38,7 +38,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex
///
/// Base class for linear algebra provider tests.
///
- [TestFixture]
+ [TestFixture, UseLinearAlgebraProvider]
public class LinearAlgebraProviderTests
{
///
@@ -54,15 +54,15 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex
///
/// Test matrix to use.
///
- private readonly IDictionary _matrices = new Dictionary
- {
- { "Singular3x3", new DenseMatrix(new[,] { { new Complex(1.0, 0), 1.0, 2.0 }, { 1.0, 1.0, 2.0 }, { 1.0, 1.0, 2.0 } }) },
- { "Square3x3", new DenseMatrix(new[,] { { new Complex(-1.1, 0), -2.2, -3.3 }, { 0.0, 1.1, 2.2 }, { -4.4, 5.5, 6.6 } }) },
- { "Square4x4", new DenseMatrix(new[,] { { new Complex(-1.1, 0), -2.2, -3.3, -4.4 }, { 0.0, 1.1, 2.2, 3.3 }, { 1.0, 2.1, 6.2, 4.3 }, { -4.4, 5.5, 6.6, -7.7 } }) },
- { "Singular4x4", new DenseMatrix(new[,] { { new Complex(-1.1, 0), -2.2, -3.3, -4.4 }, { -1.1, -2.2, -3.3, -4.4 }, { -1.1, -2.2, -3.3, -4.4 }, { -1.1, -2.2, -3.3, -4.4 } }) },
- { "Tall3x2", new DenseMatrix(new[,] { { new Complex(-1.1, 0), -2.2 }, { 0.0, 1.1 }, { -4.4, 5.5 } }) },
- { "Wide2x3", new DenseMatrix(new[,] { { new Complex(-1.1, 0), -2.2, -3.3 }, { 0.0, 1.1, 2.2 } }) }
- };
+ readonly IDictionary _matrices = new Dictionary
+ {
+ { "Singular3x3", new DenseMatrix(new[,] { { new Complex(1.0, 0), 1.0, 2.0 }, { 1.0, 1.0, 2.0 }, { 1.0, 1.0, 2.0 } }) },
+ { "Square3x3", new DenseMatrix(new[,] { { new Complex(-1.1, 0), -2.2, -3.3 }, { 0.0, 1.1, 2.2 }, { -4.4, 5.5, 6.6 } }) },
+ { "Square4x4", new DenseMatrix(new[,] { { new Complex(-1.1, 0), -2.2, -3.3, -4.4 }, { 0.0, 1.1, 2.2, 3.3 }, { 1.0, 2.1, 6.2, 4.3 }, { -4.4, 5.5, 6.6, -7.7 } }) },
+ { "Singular4x4", new DenseMatrix(new[,] { { new Complex(-1.1, 0), -2.2, -3.3, -4.4 }, { -1.1, -2.2, -3.3, -4.4 }, { -1.1, -2.2, -3.3, -4.4 }, { -1.1, -2.2, -3.3, -4.4 } }) },
+ { "Tall3x2", new DenseMatrix(new[,] { { new Complex(-1.1, 0), -2.2 }, { 0.0, 1.1 }, { -4.4, 5.5 } }) },
+ { "Wide2x3", new DenseMatrix(new[,] { { new Complex(-1.1, 0), -2.2, -3.3 }, { 0.0, 1.1, 2.2 } }) }
+ };
///
/// Can add a vector to scaled vector
diff --git a/src/UnitTests/LinearAlgebraProviderTests/Complex32/LinearAlgebraProviderTests.cs b/src/UnitTests/LinearAlgebraProviderTests/Complex32/LinearAlgebraProviderTests.cs
index f8ae7f55..ae0b8a69 100644
--- a/src/UnitTests/LinearAlgebraProviderTests/Complex32/LinearAlgebraProviderTests.cs
+++ b/src/UnitTests/LinearAlgebraProviderTests/Complex32/LinearAlgebraProviderTests.cs
@@ -39,7 +39,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex32
///
/// Base class for linear algebra provider tests.
///
- [TestFixture]
+ [TestFixture, UseLinearAlgebraProvider]
public class LinearAlgebraProviderTests
{
///
@@ -55,15 +55,15 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex32
///
/// Test matrix to use.
///
- private readonly IDictionary _matrices = new Dictionary
- {
- { "Singular3x3", new DenseMatrix(new[,] { { new Complex32(1.0f, 0.0f), 1.0f, 2.0f }, { 1.0f, 1.0f, 2.0f }, { 1.0f, 1.0f, 2.0f } }) },
- { "Square3x3", new DenseMatrix(new[,] { { new Complex32(-1.1f, 0.0f), -2.2f, -3.3f }, { 0.0f, 1.1f, 2.2f }, { -4.4f, 5.5f, 6.6f } }) },
- { "Square4x4", new DenseMatrix(new[,] { { new Complex32(-1.1f, 0.0f), -2.2f, -3.3f, -4.4f }, { 0.0f, 1.1f, 2.2f, 3.3f }, { 1.0f, 2.1f, 6.2f, 4.3f }, { -4.4f, 5.5f, 6.6f, -7.7f } }) },
- { "Singular4x4", new DenseMatrix(new[,] { { new Complex32(-1.1f, 0.0f), -2.2f, -3.3f, -4.4f }, { -1.1f, -2.2f, -3.3f, -4.4f }, { -1.1f, -2.2f, -3.3f, -4.4f }, { -1.1f, -2.2f, -3.3f, -4.4f } }) },
- { "Tall3x2", new DenseMatrix(new[,] { { new Complex32(-1.1f, 0.0f), -2.2f }, { 0.0f, 1.1f }, { -4.4f, 5.5f } }) },
- { "Wide2x3", new DenseMatrix(new[,] { { new Complex32(-1.1f, 0.0f), -2.2f, -3.3f }, { 0.0f, 1.1f, 2.2f } }) }
- };
+ readonly IDictionary _matrices = new Dictionary
+ {
+ { "Singular3x3", new DenseMatrix(new[,] { { new Complex32(1.0f, 0.0f), 1.0f, 2.0f }, { 1.0f, 1.0f, 2.0f }, { 1.0f, 1.0f, 2.0f } }) },
+ { "Square3x3", new DenseMatrix(new[,] { { new Complex32(-1.1f, 0.0f), -2.2f, -3.3f }, { 0.0f, 1.1f, 2.2f }, { -4.4f, 5.5f, 6.6f } }) },
+ { "Square4x4", new DenseMatrix(new[,] { { new Complex32(-1.1f, 0.0f), -2.2f, -3.3f, -4.4f }, { 0.0f, 1.1f, 2.2f, 3.3f }, { 1.0f, 2.1f, 6.2f, 4.3f }, { -4.4f, 5.5f, 6.6f, -7.7f } }) },
+ { "Singular4x4", new DenseMatrix(new[,] { { new Complex32(-1.1f, 0.0f), -2.2f, -3.3f, -4.4f }, { -1.1f, -2.2f, -3.3f, -4.4f }, { -1.1f, -2.2f, -3.3f, -4.4f }, { -1.1f, -2.2f, -3.3f, -4.4f } }) },
+ { "Tall3x2", new DenseMatrix(new[,] { { new Complex32(-1.1f, 0.0f), -2.2f }, { 0.0f, 1.1f }, { -4.4f, 5.5f } }) },
+ { "Wide2x3", new DenseMatrix(new[,] { { new Complex32(-1.1f, 0.0f), -2.2f, -3.3f }, { 0.0f, 1.1f, 2.2f } }) }
+ };
///
/// Can add a vector to scaled vector
diff --git a/src/UnitTests/LinearAlgebraProviderTests/Double/LinearAlgebraProviderTests.cs b/src/UnitTests/LinearAlgebraProviderTests/Double/LinearAlgebraProviderTests.cs
index 6b414058..af6d1ead 100644
--- a/src/UnitTests/LinearAlgebraProviderTests/Double/LinearAlgebraProviderTests.cs
+++ b/src/UnitTests/LinearAlgebraProviderTests/Double/LinearAlgebraProviderTests.cs
@@ -38,7 +38,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Double
///
/// Base class for linear algebra provider tests.
///
- [TestFixture]
+ [TestFixture, UseLinearAlgebraProvider]
public class LinearAlgebraProviderTests
{
///
@@ -54,15 +54,15 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Double
///
/// Test matrix to use.
///
- private readonly IDictionary _matrices = new Dictionary
- {
- { "Singular3x3", new DenseMatrix(new[,] { { 1.0, 1.0, 2.0 }, { 1.0, 1.0, 2.0 }, { 1.0, 1.0, 2.0 } }) },
- { "Square3x3", new DenseMatrix(new[,] { { -1.1, -2.2, -3.3 }, { 0.0, 1.1, 2.2 }, { -4.4, 5.5, 6.6 } }) },
- { "Square4x4", new DenseMatrix(new[,] { { -1.1, -2.2, -3.3, -4.4 }, { 0.0, 1.1, 2.2, 3.3 }, { 1.0, 2.1, 6.2, 4.3 }, { -4.4, 5.5, 6.6, -7.7 } }) },
- { "Singular4x4", new DenseMatrix(new[,] { { -1.1, -2.2, -3.3, -4.4 }, { -1.1, -2.2, -3.3, -4.4 }, { -1.1, -2.2, -3.3, -4.4 }, { -1.1, -2.2, -3.3, -4.4 } }) },
- { "Tall3x2", new DenseMatrix(new[,] { { -1.1, -2.2 }, { 0.0, 1.1 }, { -4.4, 5.5 } }) },
- { "Wide2x3", new DenseMatrix(new[,] { { -1.1, -2.2, -3.3 }, { 0.0, 1.1, 2.2 } }) }
- };
+ readonly IDictionary _matrices = new Dictionary
+ {
+ { "Singular3x3", new DenseMatrix(new[,] { { 1.0, 1.0, 2.0 }, { 1.0, 1.0, 2.0 }, { 1.0, 1.0, 2.0 } }) },
+ { "Square3x3", new DenseMatrix(new[,] { { -1.1, -2.2, -3.3 }, { 0.0, 1.1, 2.2 }, { -4.4, 5.5, 6.6 } }) },
+ { "Square4x4", new DenseMatrix(new[,] { { -1.1, -2.2, -3.3, -4.4 }, { 0.0, 1.1, 2.2, 3.3 }, { 1.0, 2.1, 6.2, 4.3 }, { -4.4, 5.5, 6.6, -7.7 } }) },
+ { "Singular4x4", new DenseMatrix(new[,] { { -1.1, -2.2, -3.3, -4.4 }, { -1.1, -2.2, -3.3, -4.4 }, { -1.1, -2.2, -3.3, -4.4 }, { -1.1, -2.2, -3.3, -4.4 } }) },
+ { "Tall3x2", new DenseMatrix(new[,] { { -1.1, -2.2 }, { 0.0, 1.1 }, { -4.4, 5.5 } }) },
+ { "Wide2x3", new DenseMatrix(new[,] { { -1.1, -2.2, -3.3 }, { 0.0, 1.1, 2.2 } }) }
+ };
///
/// Can add a vector to scaled vector
diff --git a/src/UnitTests/LinearAlgebraProviderTests/Single/LinearAlgebraProviderTests.cs b/src/UnitTests/LinearAlgebraProviderTests/Single/LinearAlgebraProviderTests.cs
index d5e30da8..9c3a0fd0 100644
--- a/src/UnitTests/LinearAlgebraProviderTests/Single/LinearAlgebraProviderTests.cs
+++ b/src/UnitTests/LinearAlgebraProviderTests/Single/LinearAlgebraProviderTests.cs
@@ -38,7 +38,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Single
///
/// Base class for linear algebra provider tests.
///
- [TestFixture]
+ [TestFixture, UseLinearAlgebraProvider]
public class LinearAlgebraProviderTests
{
///
@@ -54,15 +54,15 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Single
///
/// Test matrix to use.
///
- private readonly IDictionary _matrices = new Dictionary
- {
- { "Singular3x3", new DenseMatrix(new[,] { { 1.0f, 1.0f, 2.0f }, { 1.0f, 1.0f, 2.0f }, { 1.0f, 1.0f, 2.0f } }) },
- { "Square3x3", new DenseMatrix(new[,] { { -1.1f, -2.2f, -3.3f }, { 0.0f, 1.1f, 2.2f }, { -4.4f, 5.5f, 6.6f } }) },
- { "Square4x4", new DenseMatrix(new[,] { { -1.1f, -2.2f, -3.3f, -4.4f }, { 0.0f, 1.1f, 2.2f, 3.3f }, { 1.0f, 2.1f, 6.2f, 4.3f }, { -4.4f, 5.5f, 6.6f, -7.7f } }) },
- { "Singular4x4", new DenseMatrix(new[,] { { -1.1f, -2.2f, -3.3f, -4.4f }, { -1.1f, -2.2f, -3.3f, -4.4f }, { -1.1f, -2.2f, -3.3f, -4.4f }, { -1.1f, -2.2f, -3.3f, -4.4f } }) },
- { "Tall3x2", new DenseMatrix(new[,] { { -1.1f, -2.2f }, { 0.0f, 1.1f }, { -4.4f, 5.5f } }) },
- { "Wide2x3", new DenseMatrix(new[,] { { -1.1f, -2.2f, -3.3f }, { 0.0f, 1.1f, 2.2f } }) }
- };
+ readonly IDictionary _matrices = new Dictionary
+ {
+ { "Singular3x3", new DenseMatrix(new[,] { { 1.0f, 1.0f, 2.0f }, { 1.0f, 1.0f, 2.0f }, { 1.0f, 1.0f, 2.0f } }) },
+ { "Square3x3", new DenseMatrix(new[,] { { -1.1f, -2.2f, -3.3f }, { 0.0f, 1.1f, 2.2f }, { -4.4f, 5.5f, 6.6f } }) },
+ { "Square4x4", new DenseMatrix(new[,] { { -1.1f, -2.2f, -3.3f, -4.4f }, { 0.0f, 1.1f, 2.2f, 3.3f }, { 1.0f, 2.1f, 6.2f, 4.3f }, { -4.4f, 5.5f, 6.6f, -7.7f } }) },
+ { "Singular4x4", new DenseMatrix(new[,] { { -1.1f, -2.2f, -3.3f, -4.4f }, { -1.1f, -2.2f, -3.3f, -4.4f }, { -1.1f, -2.2f, -3.3f, -4.4f }, { -1.1f, -2.2f, -3.3f, -4.4f } }) },
+ { "Tall3x2", new DenseMatrix(new[,] { { -1.1f, -2.2f }, { 0.0f, 1.1f }, { -4.4f, 5.5f } }) },
+ { "Wide2x3", new DenseMatrix(new[,] { { -1.1f, -2.2f, -3.3f }, { 0.0f, 1.1f, 2.2f } }) }
+ };
///
/// Can add a vector to scaled vector
diff --git a/src/UnitTests/LinearAlgebraTests/Complex32/IO/MatlabReaderTests.cs b/src/UnitTests/LinearAlgebraTests/Complex32/IO/MatlabReaderTests.cs
index ae0e6dd9..b0581010 100644
--- a/src/UnitTests/LinearAlgebraTests/Complex32/IO/MatlabReaderTests.cs
+++ b/src/UnitTests/LinearAlgebraTests/Complex32/IO/MatlabReaderTests.cs
@@ -75,7 +75,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.IO
Assert.AreEqual(100, a.RowCount);
Assert.AreEqual(100, a.ColumnCount);
- AssertHelpers.AlmostEqual(13.223654390985379, a.L2Norm().Real, 7);
+ AssertHelpers.AlmostEqual(13.223654390985379, a.L2Norm().Real, 5);
}
///
diff --git a/src/UnitTests/UnitTests.csproj b/src/UnitTests/UnitTests.csproj
index 6ca40e38..06f03500 100644
--- a/src/UnitTests/UnitTests.csproj
+++ b/src/UnitTests/UnitTests.csproj
@@ -764,7 +764,6 @@
-
@@ -781,6 +780,7 @@
+
diff --git a/src/UnitTests/Setup.cs b/src/UnitTests/UseLinearAlgebraProvider.cs
similarity index 66%
rename from src/UnitTests/Setup.cs
rename to src/UnitTests/UseLinearAlgebraProvider.cs
index 6b51861a..0b46213f 100644
--- a/src/UnitTests/Setup.cs
+++ b/src/UnitTests/UseLinearAlgebraProvider.cs
@@ -1,9 +1,11 @@
-//
+//
// 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-2010 Math.NET
+//
+// Copyright (c) 2009-2012 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
@@ -12,8 +14,10 @@
// 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
@@ -26,24 +30,23 @@
using NUnit.Framework;
-///
-/// Setup properties for the unit tests.
-///
-///
-[SetUpFixture]
-public class Setup
+namespace MathNet.Numerics.UnitTests
{
- ///
- /// Sets up the linear algebra provider based on the App.config setting.
- ///
- [SetUp]
- public void SetupProvider()
+ public class UseLinearAlgebraProvider : TestActionAttribute
{
- var provider = MathNet.Numerics.UnitTests.Properties.Settings.Default.LinearAlgebraProvider.ToLowerInvariant();
+ public override void BeforeTest(TestDetails testDetails)
+ {
+ var provider = Properties.Settings.Default.LinearAlgebraProvider.ToLowerInvariant();
+
+ if (provider.Contains("mkl"))
+ {
+ Control.LinearAlgebraProvider = new Algorithms.LinearAlgebra.Mkl.MklLinearAlgebraProvider();
+ }
+ }
- if (provider.Contains("mkl"))
+ public override ActionTargets Targets
{
- MathNet.Numerics.Control.LinearAlgebraProvider = new MathNet.Numerics.Algorithms.LinearAlgebra.Mkl.MklLinearAlgebraProvider();
+ get { return ActionTargets.Suite; }
}
}
}