From b61f6df24d094c5a2524888db02612a4ab509032 Mon Sep 17 00:00:00 2001 From: Marcus Cuda Date: Thu, 7 Jan 2010 15:47:05 +0800 Subject: [PATCH] LA providers: reworked how the tests setup --- .../ATLASWrapperTests.csproj | 5 +- ....cs => AtlasLinearAlgebraProviderTests.cs} | 4 +- .../LinearAlgebra/Double/NativeVectorTests.cs | 23 -- ...ts.cs => MklLinearAlgebraProviderTests.cs} | 4 +- .../MKLWrapper32Tests.csproj | 5 +- .../MKLWrapper64Tests.csproj | 7 +- src/NativeWrappers/NativeWrappers.sln | 11 - .../Double/LinearAlgebraProviderTests.cs | 200 ++++++++++++++++++ .../ManagedLinearAlgebraProviderTests.cs | 13 ++ .../LinearAlgebraTests/Double/MatrixTests.cs | 1 + .../LinearAlgebraTests/Double/VectorTests.cs | 1 + src/UnitTests/UnitTests.csproj | 2 + 12 files changed, 225 insertions(+), 51 deletions(-) rename src/NativeWrappers/ATLASWrapperTests/LinearAlgebra/Double/{AtlasVectorTests.cs => AtlasLinearAlgebraProviderTests.cs} (70%) delete mode 100644 src/NativeWrappers/Common/LinearAlgebra/Double/NativeVectorTests.cs rename src/NativeWrappers/MKLWrapper32Tests/LinearAlgebra/Double/{MklVectorTests.cs => MklLinearAlgebraProviderTests.cs} (70%) create mode 100644 src/UnitTests/LinearAlgebraTests/Double/LinearAlgebraProviderTests.cs create mode 100644 src/UnitTests/LinearAlgebraTests/Double/ManagedLinearAlgebraProviderTests.cs diff --git a/src/NativeWrappers/ATLASWrapperTests/ATLASWrapperTests.csproj b/src/NativeWrappers/ATLASWrapperTests/ATLASWrapperTests.csproj index bedb0085..b1b52fdb 100644 --- a/src/NativeWrappers/ATLASWrapperTests/ATLASWrapperTests.csproj +++ b/src/NativeWrappers/ATLASWrapperTests/ATLASWrapperTests.csproj @@ -66,10 +66,7 @@ - - LinearAlgebra\Double\NativeVectorTests.cs - - + diff --git a/src/NativeWrappers/ATLASWrapperTests/LinearAlgebra/Double/AtlasVectorTests.cs b/src/NativeWrappers/ATLASWrapperTests/LinearAlgebra/Double/AtlasLinearAlgebraProviderTests.cs similarity index 70% rename from src/NativeWrappers/ATLASWrapperTests/LinearAlgebra/Double/AtlasVectorTests.cs rename to src/NativeWrappers/ATLASWrapperTests/LinearAlgebra/Double/AtlasLinearAlgebraProviderTests.cs index 343b898c..f2a9b7b4 100644 --- a/src/NativeWrappers/ATLASWrapperTests/LinearAlgebra/Double/AtlasVectorTests.cs +++ b/src/NativeWrappers/ATLASWrapperTests/LinearAlgebra/Double/AtlasLinearAlgebraProviderTests.cs @@ -1,9 +1,9 @@ namespace MathNet.Numerics.ATLASWrapperTests.LinearAlgebra.Double { using MbUnit.Framework; - using Numerics.LinearAlgebra.Double; + using UnitTests.LinearAlgebraTests.Double; - public class AtlasVectorTests : NativeVectorTests + public class AtlasLinearAlgebraProviderTests : LinearAlgebraProviderTests { [FixtureSetUp] public void SetUpProvider() diff --git a/src/NativeWrappers/Common/LinearAlgebra/Double/NativeVectorTests.cs b/src/NativeWrappers/Common/LinearAlgebra/Double/NativeVectorTests.cs deleted file mode 100644 index b18ca689..00000000 --- a/src/NativeWrappers/Common/LinearAlgebra/Double/NativeVectorTests.cs +++ /dev/null @@ -1,23 +0,0 @@ -namespace MathNet.Numerics.LinearAlgebra.Double -{ - using System.Collections.Generic; - - public abstract class NativeVectorTests : UnitTests.LinearAlgebraTests.Double.VectorTests - { - protected override Vector CreateVector(int size) - { - return new DenseVector(size); - } - - protected override Vector CreateVector(IList data) - { - var vector = new DenseVector(data.Count); - for (var index = 0; index < data.Count; index++) - { - vector[index] = data[index]; - } - - return vector; - } - } -} \ No newline at end of file diff --git a/src/NativeWrappers/MKLWrapper32Tests/LinearAlgebra/Double/MklVectorTests.cs b/src/NativeWrappers/MKLWrapper32Tests/LinearAlgebra/Double/MklLinearAlgebraProviderTests.cs similarity index 70% rename from src/NativeWrappers/MKLWrapper32Tests/LinearAlgebra/Double/MklVectorTests.cs rename to src/NativeWrappers/MKLWrapper32Tests/LinearAlgebra/Double/MklLinearAlgebraProviderTests.cs index 9b8b72a9..772680cc 100644 --- a/src/NativeWrappers/MKLWrapper32Tests/LinearAlgebra/Double/MklVectorTests.cs +++ b/src/NativeWrappers/MKLWrapper32Tests/LinearAlgebra/Double/MklLinearAlgebraProviderTests.cs @@ -1,9 +1,9 @@ namespace MathNet.Numerics.MKLWrapperTests.LinearAlgebra.Double { using MbUnit.Framework; - using Numerics.LinearAlgebra.Double; + using UnitTests.LinearAlgebraTests.Double; - public class MklVectorTests : NativeVectorTests + public class MklLinearAlgebraProviderTests : LinearAlgebraProviderTests { [FixtureSetUp] public void SetUpProvider() diff --git a/src/NativeWrappers/MKLWrapper32Tests/MKLWrapper32Tests.csproj b/src/NativeWrappers/MKLWrapper32Tests/MKLWrapper32Tests.csproj index 20bf3485..0149b29d 100644 --- a/src/NativeWrappers/MKLWrapper32Tests/MKLWrapper32Tests.csproj +++ b/src/NativeWrappers/MKLWrapper32Tests/MKLWrapper32Tests.csproj @@ -66,10 +66,7 @@ - - LinearAlgebra\Double\NativeVectorTests.cs - - + diff --git a/src/NativeWrappers/MKLWrapper64Tests/MKLWrapper64Tests.csproj b/src/NativeWrappers/MKLWrapper64Tests/MKLWrapper64Tests.csproj index e149d2ab..92f68496 100644 --- a/src/NativeWrappers/MKLWrapper64Tests/MKLWrapper64Tests.csproj +++ b/src/NativeWrappers/MKLWrapper64Tests/MKLWrapper64Tests.csproj @@ -70,11 +70,8 @@ - - LinearAlgebra\Double\NativeVectorTests.cs - - - LinearAlgebra\Double\MklVectorTests.cs + + LinearAlgebra\Double\MklLinearAlgebraProviderTests.cs diff --git a/src/NativeWrappers/NativeWrappers.sln b/src/NativeWrappers/NativeWrappers.sln index ad3d055e..d6c3e8c6 100644 --- a/src/NativeWrappers/NativeWrappers.sln +++ b/src/NativeWrappers/NativeWrappers.sln @@ -19,13 +19,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MKLWrapper64Tests", "MKLWra EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MKLWrapper32Tests", "MKLWrapper32Tests\MKLWrapper32Tests.csproj", "{D0AD591B-0CE6-4A6D-8DEA-01777EE09BC3}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LinearAlgebra", "LinearAlgebra", "{28304BC9-F668-4D43-9055-E1D37090F7A2}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Double", "Double", "{7957ECEC-3AAE-40CD-9A79-8DFDF284B3FE}" - ProjectSection(SolutionItems) = preProject - Common\LinearAlgebra\Double\NativeVectorTests.cs = Common\LinearAlgebra\Double\NativeVectorTests.cs - EndProjectSection -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -104,8 +97,4 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {28304BC9-F668-4D43-9055-E1D37090F7A2} = {5A0892FF-82CE-40FC-BCE1-73810C615F52} - {7957ECEC-3AAE-40CD-9A79-8DFDF284B3FE} = {28304BC9-F668-4D43-9055-E1D37090F7A2} - EndGlobalSection EndGlobal diff --git a/src/UnitTests/LinearAlgebraTests/Double/LinearAlgebraProviderTests.cs b/src/UnitTests/LinearAlgebraTests/Double/LinearAlgebraProviderTests.cs new file mode 100644 index 00000000..b0457fab --- /dev/null +++ b/src/UnitTests/LinearAlgebraTests/Double/LinearAlgebraProviderTests.cs @@ -0,0 +1,200 @@ +namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double +{ + using Algorithms.LinearAlgebra; + using MbUnit.Framework; + + [TestFixture] + public abstract class LinearAlgebraProviderTests + { + protected ILinearAlgebraProvider Provider{ get; set;} + + [Test, Ignore] + public void CanAddVectorToScaledVector(double[] y, double alpha, double[] x) + { + + } + + [Test, Ignore] + public void CanScaleArray(double alpha, double[] x) + { + + } + + [Test, Ignore] + public void CanComputeDotProduct(double[] x, double[] y) + { + + } + + [Test, Ignore] + public void CanAddArrays(double[] x, double[] y, double[] result) + { + + } + + [Test, Ignore] + public void CanSubtractArrays(double[] x, double[] y, double[] result) + { + + } + + [Test, Ignore] + public void CanPointWiseMultiplyArrays(double[] x, double[] y, double[] result) + { + + } + + [Test, Ignore] + public void CanComputeMatrixNorm(Norm norm, double[] matrix){} + + [Test, Ignore] + public void CanComputeMatrixNorm(Norm norm, double[] matrix, double[] work) + { + + } + + [Test, Ignore] + public void CanMatrixMultiply(double[] x, int xRows, int xColumns, double[] y, int yRows, int yColumns, double[] result) + { + + } + + [Test, Ignore] + public void CanMatrixMultiplyWithUpdate(Transpose transposeA, Transpose transposeB, double alpha, double[] a, + int aRows, int aColumns, double[] b, int bRows, int bColumns, double beta, double[] c) + { + + } + + [Test, Ignore] + public void CanComputeLUFactor(double[] a, int[] ipiv) + { + + } + + [Test, Ignore] + public void CanComputeLUInverse(double[] a) + { + + } + + public void CanComputeLUInverseFactored(double[] a, int[] ipiv) + { + + } + + [Test, Ignore] + public void CanComputeLUInverse(double[] a, double[] work) + { + + } + + [Test, Ignore] + public void CanComputeLUInverseFactored(double[] a, int[] ipiv, double[] work) + { + + } + + [Test, Ignore] + public void CanComputeLUSolve(int columnsOfB, double[] a, double[] b) + { + + } + + [Test, Ignore] + public void CanComputeLUSolveFactored(int columnsOfB, double[] a, int ipiv, double[] b) + { + + } + + [Test, Ignore] + public void CanComputeLUSolve(Transpose transposeA, int columnsOfB, double[] a, double[] b) + { + + } + + [Test, Ignore] + public void CanComputeLUSolveFactored(Transpose transposeA, int columnsOfB, double[] a, int ipiv, double[] b) + { + + } + + [Test, Ignore] + public void CanComputeCholeskyFactor(double[] a, int order) + { + + } + + [Test, Ignore] + public void CanComputeCholeskySolve(int columnsOfB, double[] a, double[] b) + { + + } + + [Test, Ignore] + public void CanComputeCholeskySolveFactored(int columnsOfB, double[] a, double[] b) + { + + } + + [Test, Ignore] + public void CanComputeQRFactor(double[] r, double[] q) + { + + } + + [Test, Ignore] + public void CanComputeQRFactor(double[] r, double[] q, double[] work) + { + + } + + [Test, Ignore] + public void CanComputeQRSolve(int columnsOfB, double[] r, double[] q, double[] b, double[] x) + { + + } + + [Test, Ignore] + public void CanComputeQRSolve(int columnsOfB, double[] r, double[] q, double[] b, double[] x, double[] work) + { + + } + + [Test, Ignore] + public void CanComputeQRSolveFactored(int columnsOfB, double[] q, double[] r, double[] b, double[] x) + { + + } + + [Test, Ignore] + public void CanComputeSinguarValueDecomposition(bool computeVectors, double[] a, double[] s, double[] u, double[] vt) + { + + } + + [Test, Ignore] + public void CanComputeSingularValueDecomposition(bool computeVectors, double[] a, double[] s, double[] u, double[] vt, double[] work) + { + + } + + [Test, Ignore] + public void CanComputeSvdSolve(double[] a, double[] s, double[] u, double[] vt, double[] b, double[] x) + { + + } + + [Test, Ignore] + public void CanComputeSvdSolve(double[] a, double[] s, double[] u, double[] vt, double[] b, double[] x, double[] work) + { + + } + + [Test, Ignore] + public void CanComputeSvdSolveFactored(int columnsOfB, double[] s, double[] u, double[] vt, double[] b, double[] x) + { + + } + } +} \ No newline at end of file diff --git a/src/UnitTests/LinearAlgebraTests/Double/ManagedLinearAlgebraProviderTests.cs b/src/UnitTests/LinearAlgebraTests/Double/ManagedLinearAlgebraProviderTests.cs new file mode 100644 index 00000000..f5827590 --- /dev/null +++ b/src/UnitTests/LinearAlgebraTests/Double/ManagedLinearAlgebraProviderTests.cs @@ -0,0 +1,13 @@ +namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double +{ + using MbUnit.Framework; + + public class ManagedLinearAlgebraProviderTests : LinearAlgebraProviderTests + { + [FixtureSetUp] + public void SetProvider() + { + Provider = new Algorithms.LinearAlgebra.ManagedLinearAlgebraProvider(); + } + } +} diff --git a/src/UnitTests/LinearAlgebraTests/Double/MatrixTests.cs b/src/UnitTests/LinearAlgebraTests/Double/MatrixTests.cs index f57667ba..94224489 100644 --- a/src/UnitTests/LinearAlgebraTests/Double/MatrixTests.cs +++ b/src/UnitTests/LinearAlgebraTests/Double/MatrixTests.cs @@ -6,6 +6,7 @@ using MbUnit.Framework; namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { + [TestFixture] public abstract partial class MatrixTests { protected Dictionary testData2D; diff --git a/src/UnitTests/LinearAlgebraTests/Double/VectorTests.cs b/src/UnitTests/LinearAlgebraTests/Double/VectorTests.cs index f1877d40..6e2ee0f1 100644 --- a/src/UnitTests/LinearAlgebraTests/Double/VectorTests.cs +++ b/src/UnitTests/LinearAlgebraTests/Double/VectorTests.cs @@ -8,6 +8,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { using System.Collections; + [TestFixture] public abstract partial class VectorTests { protected readonly double[] _data = {1, 2, 3, 4, 5}; diff --git a/src/UnitTests/UnitTests.csproj b/src/UnitTests/UnitTests.csproj index 9afa63cb..da4ec07a 100644 --- a/src/UnitTests/UnitTests.csproj +++ b/src/UnitTests/UnitTests.csproj @@ -90,6 +90,8 @@ + +