diff --git a/MathNet.Numerics.Data.sln.DotSettings b/MathNet.Numerics.Data.sln.DotSettings new file mode 100644 index 00000000..104d6356 --- /dev/null +++ b/MathNet.Numerics.Data.sln.DotSettings @@ -0,0 +1,82 @@ + + True + HINT + HINT + <?xml version="1.0" encoding="utf-16"?><Profile name="Full Cleanup (Math.NET)"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSRemoveCodeRedundancies>True</CSRemoveCodeRedundancies><CSUseAutoProperty>True</CSUseAutoProperty><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSUpdateFileHeader>True</CSUpdateFileHeader><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><CSReformatCode>True</CSReformatCode><XMLReformatCode>True</XMLReformatCode><CssAlphabetizeProperties>True</CssAlphabetizeProperties><CssReformatCode>True</CssReformatCode><JsReformatCode>True</JsReformatCode><JsInsertSemicolon>True</JsInsertSemicolon><VBFormatDocComments>True</VBFormatDocComments><VBReformatCode>True</VBReformatCode><VBShortenReferences>True</VBShortenReferences><VBOptimizeImports>True</VBOptimizeImports><HtmlReformatCode>True</HtmlReformatCode><AspOptimizeRegisterDirectives>True</AspOptimizeRegisterDirectives><CSReorderTypeMembers>True</CSReorderTypeMembers><CSUseVar><BehavourStyle>CAN_CHANGE_BOTH</BehavourStyle><LocalVariableStyle>IMPLICIT_WHEN_INITIALIZER_HAS_TYPE</LocalVariableStyle><ForeachVariableStyle>ALWAYS_EXPLICIT</ForeachVariableStyle></CSUseVar></Profile> + Full Cleanup (Math.NET) + False + False + False + False + False + False + False + False + False + False + False + True + False + False + False + True + True + False + <copyright file="$FILENAME$" company="Math.NET"> +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-$CURRENT_YEAR$ 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 +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +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 +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. +</copyright> + AVX + CDF + DFT + FFT + IA + ILU + ILUTP + IX + LU + MAE + MC + MCMC + MILU + MKL + MSE + PDF + PMF + QR + SAD + SAS + SPSS + SSD + SSE + SVD + TFQMR + WH + True + <data /> + <data><IncludeFilters /><ExcludeFilters /></data> \ No newline at end of file diff --git a/src/Data/Matlab/Matlab.csproj b/src/Data/Matlab/Matlab.csproj index 6e4f7cff..e612944b 100644 --- a/src/Data/Matlab/Matlab.csproj +++ b/src/Data/Matlab/Matlab.csproj @@ -55,7 +55,7 @@ - + diff --git a/src/Data/Matlab/MatlabReader.cs b/src/Data/Matlab/MatlabReader.cs index fdef0882..c5ef2bbe 100644 --- a/src/Data/Matlab/MatlabReader.cs +++ b/src/Data/Matlab/MatlabReader.cs @@ -39,14 +39,14 @@ namespace MathNet.Numerics.Data.Matlab /// /// Creates matrices from MATLAB files. /// - public static class MatlabMatrixReader + public static class MatlabReader { /// The data type of the Matrix. It can be either: double, float, Complex, or Complex32. public static Matrix ReadMatrix(Stream stream, string matrixName = null) where TDataType : struct, IEquatable, IFormattable { var names = string.IsNullOrEmpty(matrixName) ? new string[] { } : new[] { matrixName }; - var parser = new MatlabParser(stream, names); + var parser = new Parser(stream, names); var file = parser.Parse(); if (string.IsNullOrEmpty(matrixName)) @@ -76,7 +76,7 @@ namespace MathNet.Numerics.Data.Matlab public static Dictionary> ReadMatrices(Stream stream, params string[] matrixNames) where TDataType : struct, IEquatable, IFormattable { - var parser = new MatlabParser(stream, matrixNames); + var parser = new Parser(stream, matrixNames); var file = parser.Parse(); return file.Matrices.ToDictionary(matrix => matrix.Key, matrix => matrix.Value); } diff --git a/src/Data/Matlab/MatlabWriter.cs b/src/Data/Matlab/MatlabWriter.cs index 3445d156..ab43ecd5 100644 --- a/src/Data/Matlab/MatlabWriter.cs +++ b/src/Data/Matlab/MatlabWriter.cs @@ -43,7 +43,7 @@ namespace MathNet.Numerics.Data.Matlab /// /// Writes matrices to a MATLAB file. /// - public class MatlabMatrixWriter : IDisposable + public class MatlabWriter : IDisposable { /// /// The file header value @@ -66,10 +66,10 @@ namespace MathNet.Numerics.Data.Matlab BinaryWriter _writer; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The name of the MATLAB file to save the matrices to. - public MatlabMatrixWriter(string filename) + public MatlabWriter(string filename) { if (string.IsNullOrEmpty(filename)) { diff --git a/src/Data/Matlab/MatlabParser.cs b/src/Data/Matlab/Parser.cs similarity index 94% rename from src/Data/Matlab/MatlabParser.cs rename to src/Data/Matlab/Parser.cs index addf924e..aa68f9d4 100644 --- a/src/Data/Matlab/MatlabParser.cs +++ b/src/Data/Matlab/Parser.cs @@ -1,4 +1,4 @@ -// +// // Math.NET Numerics, part of the Math.NET Project // http://numerics.mathdotnet.com // http://github.com/mathnet/mathnet-numerics @@ -42,7 +42,7 @@ namespace MathNet.Numerics.Data.Matlab /// Parse a MATLAB file /// /// The data type of the matrix. - internal class MatlabParser + internal class Parser where TDataType : struct, IEquatable, IFormattable { /// @@ -71,29 +71,29 @@ namespace MathNet.Numerics.Data.Matlab readonly Stream _stream; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Name of the file. - internal MatlabParser(string fileName) + internal Parser(string fileName) : this(fileName, new string[0]) { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The stream to read from. - internal MatlabParser(Stream stream) + internal Parser(Stream stream) : this(stream, new string[0]) { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The stream to read from. /// The name of the objects to retrieve. - internal MatlabParser(Stream stream, IEnumerable objectNames) + internal Parser(Stream stream, IEnumerable objectNames) { if (stream == null) { @@ -105,11 +105,11 @@ namespace MathNet.Numerics.Data.Matlab } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Name of the file. /// The name of the objects to retrieve. - MatlabParser(string fileName, IEnumerable objectNames) + Parser(string fileName, IEnumerable objectNames) { if (string.IsNullOrEmpty(fileName)) { diff --git a/src/Data/Matlab/SparseArrayReader.cs b/src/Data/Matlab/SparseArrayReader.cs index 3d7aabf3..0faa596e 100644 --- a/src/Data/Matlab/SparseArrayReader.cs +++ b/src/Data/Matlab/SparseArrayReader.cs @@ -63,7 +63,7 @@ namespace MathNet.Numerics.Data.Matlab ir[i] = reader.ReadInt32(); } - MatlabParser.AlignData(reader.BaseStream, size, false); + Parser.AlignData(reader.BaseStream, size, false); // skip data type since it will always be int32 reader.BaseStream.Seek(4, SeekOrigin.Current); @@ -81,7 +81,7 @@ namespace MathNet.Numerics.Data.Matlab jc[j] = reader.ReadInt32(); } - MatlabParser.AlignData(reader.BaseStream, jcsize, false); + Parser.AlignData(reader.BaseStream, jcsize, false); var type = (DataType)reader.ReadInt32(); var dataSize = reader.ReadInt32(); diff --git a/src/DataUnitTests/Matlab/MatlabReaderTests.cs b/src/DataUnitTests/Matlab/MatlabReaderTests.cs index a0501ccb..c4cf8655 100644 --- a/src/DataUnitTests/Matlab/MatlabReaderTests.cs +++ b/src/DataUnitTests/Matlab/MatlabReaderTests.cs @@ -34,7 +34,7 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab /// Matlab matrix reader test. /// [TestFixture] - public class MatlabMatrixReaderTests + public class MatlabReaderTests { /// /// Can read all matrices. @@ -42,11 +42,11 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadAllMatrices() { - var matrices = MatlabMatrixReader.ReadMatrices("./data/Matlab/collection.mat"); + var matrices = MatlabReader.ReadMatrices("./data/Matlab/collection.mat"); Assert.AreEqual(30, matrices.Count); foreach (var matrix in matrices) { - Assert.AreEqual(typeof(LinearAlgebra.Double.DenseMatrix), matrix.Value.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Double.DenseMatrix), matrix.Value.GetType()); } } @@ -56,10 +56,10 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadFirstMatrix() { - var matrix = MatlabMatrixReader.ReadMatrix("./data/Matlab/A.mat"); + var matrix = MatlabReader.ReadMatrix("./data/Matlab/A.mat"); Assert.AreEqual(100, matrix.RowCount); Assert.AreEqual(100, matrix.ColumnCount); - Assert.AreEqual(typeof(LinearAlgebra.Double.DenseMatrix), matrix.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Double.DenseMatrix), matrix.GetType()); AssertHelpers.AlmostEqual(100.108979553704, matrix.FrobeniusNorm(), 5); } @@ -69,11 +69,11 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadNamedMatrices() { - var matrices = MatlabMatrixReader.ReadMatrices("./data/Matlab/collection.mat", "Ad", "Au64"); + var matrices = MatlabReader.ReadMatrices("./data/Matlab/collection.mat", "Ad", "Au64"); Assert.AreEqual(2, matrices.Count); foreach (var matrix in matrices) { - Assert.AreEqual(typeof(LinearAlgebra.Double.DenseMatrix), matrix.Value.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Double.DenseMatrix), matrix.Value.GetType()); } } @@ -83,13 +83,13 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadNamedMatrix() { - var matrices = MatlabMatrixReader.ReadMatrices("./data/Matlab/collection.mat", "Ad"); + var matrices = MatlabReader.ReadMatrices("./data/Matlab/collection.mat", "Ad"); Assert.AreEqual(1, matrices.Count); var ad = matrices["Ad"]; Assert.AreEqual(100, ad.RowCount); Assert.AreEqual(100, ad.ColumnCount); AssertHelpers.AlmostEqual(100.431635988639, ad.FrobeniusNorm(), 5); - Assert.AreEqual(typeof(LinearAlgebra.Double.DenseMatrix), ad.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Double.DenseMatrix), ad.GetType()); } /// @@ -98,24 +98,24 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadNamedSparseMatrix() { - var matrix = MatlabMatrixReader.ReadMatrix("./data/Matlab/sparse-small.mat", "S"); + var matrix = MatlabReader.ReadMatrix("./data/Matlab/sparse-small.mat", "S"); Assert.AreEqual(100, matrix.RowCount); Assert.AreEqual(100, matrix.ColumnCount); - Assert.AreEqual(typeof(LinearAlgebra.Double.SparseMatrix), matrix.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Double.SparseMatrix), matrix.GetType()); AssertHelpers.AlmostEqual(17.6385090630805, matrix.FrobeniusNorm(), 12); } - - /// + + /// /// Can read all complex matrices. /// [Test] public void CanReadComplexAllMatrices() { - var matrices = MatlabMatrixReader.ReadMatrices("./data/Matlab/complex.mat"); + var matrices = MatlabReader.ReadMatrices("./data/Matlab/complex.mat"); Assert.AreEqual(3, matrices.Count); foreach (var matrix in matrices) { - Assert.AreEqual(typeof(LinearAlgebra.Complex.DenseMatrix), matrix.Value.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Complex.DenseMatrix), matrix.Value.GetType()); } var a = matrices["a"]; @@ -131,11 +131,11 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadSparseComplexAllMatrices() { - var matrices = MatlabMatrixReader.ReadMatrices("./data/Matlab/sparse_complex.mat"); + var matrices = MatlabReader.ReadMatrices("./data/Matlab/sparse_complex.mat"); Assert.AreEqual(3, matrices.Count); foreach (var matrix in matrices) { - Assert.AreEqual(typeof(LinearAlgebra.Complex.SparseMatrix), matrix.Value.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Complex.SparseMatrix), matrix.Value.GetType()); } var a = matrices["sa"]; @@ -151,11 +151,11 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadNonComplexAllMatrices() { - var matrices = MatlabMatrixReader.ReadMatrices("./data/Matlab/collection.mat"); + var matrices = MatlabReader.ReadMatrices("./data/Matlab/collection.mat"); Assert.AreEqual(30, matrices.Count); foreach (var matrix in matrices) { - Assert.AreEqual(typeof(LinearAlgebra.Complex.DenseMatrix), matrix.Value.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Complex.DenseMatrix), matrix.Value.GetType()); } } @@ -165,10 +165,10 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadNonComplexFirstMatrix() { - var matrix = MatlabMatrixReader.ReadMatrix("./data/Matlab/A.mat"); + var matrix = MatlabReader.ReadMatrix("./data/Matlab/A.mat"); Assert.AreEqual(100, matrix.RowCount); Assert.AreEqual(100, matrix.ColumnCount); - Assert.AreEqual(typeof(LinearAlgebra.Complex.DenseMatrix), matrix.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Complex.DenseMatrix), matrix.GetType()); AssertHelpers.AlmostEqual(100.108979553704, matrix.FrobeniusNorm(), 13); } @@ -178,11 +178,11 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadNonComplexNamedMatrices() { - var matrices = MatlabMatrixReader.ReadMatrices("./data/Matlab/collection.mat", "Ad", "Au64"); + var matrices = MatlabReader.ReadMatrices("./data/Matlab/collection.mat", "Ad", "Au64"); Assert.AreEqual(2, matrices.Count); foreach (var matrix in matrices) { - Assert.AreEqual(typeof(LinearAlgebra.Complex.DenseMatrix), matrix.Value.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Complex.DenseMatrix), matrix.Value.GetType()); } } @@ -192,13 +192,13 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadNonComplexNamedMatrix() { - var matrices = MatlabMatrixReader.ReadMatrices("./data/Matlab/collection.mat", "Ad"); + var matrices = MatlabReader.ReadMatrices("./data/Matlab/collection.mat", "Ad"); Assert.AreEqual(1, matrices.Count); var ad = matrices["Ad"]; Assert.AreEqual(100, ad.RowCount); Assert.AreEqual(100, ad.ColumnCount); AssertHelpers.AlmostEqual(100.431635988639, ad.FrobeniusNorm(), 13); - Assert.AreEqual(typeof(LinearAlgebra.Complex.DenseMatrix), ad.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Complex.DenseMatrix), ad.GetType()); } /// @@ -207,10 +207,10 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadNonComplexNamedSparseMatrix() { - var matrix = MatlabMatrixReader.ReadMatrix("./data/Matlab/sparse-small.mat", "S"); + var matrix = MatlabReader.ReadMatrix("./data/Matlab/sparse-small.mat", "S"); Assert.AreEqual(100, matrix.RowCount); Assert.AreEqual(100, matrix.ColumnCount); - Assert.AreEqual(typeof(LinearAlgebra.Complex.SparseMatrix), matrix.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Complex.SparseMatrix), matrix.GetType()); AssertHelpers.AlmostEqual(17.6385090630805, matrix.FrobeniusNorm(), 12); } @@ -220,11 +220,11 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadComplex32AllMatrices() { - var matrices = MatlabMatrixReader.ReadMatrices("./data/Matlab/complex.mat"); + var matrices = MatlabReader.ReadMatrices("./data/Matlab/complex.mat"); Assert.AreEqual(3, matrices.Count); foreach (var matrix in matrices) { - Assert.AreEqual(typeof(LinearAlgebra.Complex32.DenseMatrix), matrix.Value.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Complex32.DenseMatrix), matrix.Value.GetType()); } var a = matrices["a"]; @@ -240,11 +240,11 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadSparseComplex32AllMatrices() { - var matrices = MatlabMatrixReader.ReadMatrices("./data/Matlab/sparse_complex.mat"); + var matrices = MatlabReader.ReadMatrices("./data/Matlab/sparse_complex.mat"); Assert.AreEqual(3, matrices.Count); foreach (var matrix in matrices) { - Assert.AreEqual(typeof(LinearAlgebra.Complex32.SparseMatrix), matrix.Value.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Complex32.SparseMatrix), matrix.Value.GetType()); } var a = matrices["sa"]; @@ -260,11 +260,11 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadNonComplex32AllMatrices() { - var matrices = MatlabMatrixReader.ReadMatrices("./data/Matlab/collection.mat"); + var matrices = MatlabReader.ReadMatrices("./data/Matlab/collection.mat"); Assert.AreEqual(30, matrices.Count); foreach (var matrix in matrices) { - Assert.AreEqual(typeof(LinearAlgebra.Complex32.DenseMatrix), matrix.Value.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Complex32.DenseMatrix), matrix.Value.GetType()); } } @@ -274,10 +274,10 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadNonComplex32FirstMatrix() { - var matrix = MatlabMatrixReader.ReadMatrix("./data/Matlab/A.mat"); + var matrix = MatlabReader.ReadMatrix("./data/Matlab/A.mat"); Assert.AreEqual(100, matrix.RowCount); Assert.AreEqual(100, matrix.ColumnCount); - Assert.AreEqual(typeof(LinearAlgebra.Complex32.DenseMatrix), matrix.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Complex32.DenseMatrix), matrix.GetType()); AssertHelpers.AlmostEqual(100.108979553704, matrix.FrobeniusNorm(), 6); } @@ -287,11 +287,11 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadNonComplex32NamedMatrices() { - var matrices = MatlabMatrixReader.ReadMatrices("./data/Matlab/collection.mat", "Ad", "Au64"); + var matrices = MatlabReader.ReadMatrices("./data/Matlab/collection.mat", "Ad", "Au64"); Assert.AreEqual(2, matrices.Count); foreach (var matrix in matrices) { - Assert.AreEqual(typeof(LinearAlgebra.Complex32.DenseMatrix), matrix.Value.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Complex32.DenseMatrix), matrix.Value.GetType()); } } @@ -301,13 +301,13 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadNonComplex32NamedMatrix() { - var matrices = MatlabMatrixReader.ReadMatrices("./data/Matlab/collection.mat", "Ad"); + var matrices = MatlabReader.ReadMatrices("./data/Matlab/collection.mat", "Ad"); Assert.AreEqual(1, matrices.Count); var ad = matrices["Ad"]; Assert.AreEqual(100, ad.RowCount); Assert.AreEqual(100, ad.ColumnCount); AssertHelpers.AlmostEqual(100.431635988639, ad.FrobeniusNorm(), 6); - Assert.AreEqual(typeof(LinearAlgebra.Complex32.DenseMatrix), ad.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Complex32.DenseMatrix), ad.GetType()); } /// @@ -316,10 +316,10 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadNonComplex32NamedSparseMatrix() { - var matrix = MatlabMatrixReader.ReadMatrix("./data/Matlab/sparse-small.mat", "S"); + var matrix = MatlabReader.ReadMatrix("./data/Matlab/sparse-small.mat", "S"); Assert.AreEqual(100, matrix.RowCount); Assert.AreEqual(100, matrix.ColumnCount); - Assert.AreEqual(typeof(LinearAlgebra.Complex32.SparseMatrix), matrix.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Complex32.SparseMatrix), matrix.GetType()); AssertHelpers.AlmostEqual(17.6385090630805, matrix.FrobeniusNorm(), 6); } @@ -329,11 +329,11 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadFloatAllMatrices() { - var matrices = MatlabMatrixReader.ReadMatrices("./data/Matlab/collection.mat"); + var matrices = MatlabReader.ReadMatrices("./data/Matlab/collection.mat"); Assert.AreEqual(30, matrices.Count); foreach (var matrix in matrices) { - Assert.AreEqual(typeof(LinearAlgebra.Single.DenseMatrix), matrix.Value.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Single.DenseMatrix), matrix.Value.GetType()); } } @@ -343,10 +343,10 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadFloatFirstMatrix() { - var matrix = MatlabMatrixReader.ReadMatrix("./data/Matlab/A.mat"); + var matrix = MatlabReader.ReadMatrix("./data/Matlab/A.mat"); Assert.AreEqual(100, matrix.RowCount); Assert.AreEqual(100, matrix.ColumnCount); - Assert.AreEqual(typeof(LinearAlgebra.Single.DenseMatrix), matrix.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Single.DenseMatrix), matrix.GetType()); AssertHelpers.AlmostEqual(100.108979553704f, matrix.FrobeniusNorm(), 6); } @@ -356,11 +356,11 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadFloatNamedMatrices() { - var matrices = MatlabMatrixReader.ReadMatrices("./data/Matlab/collection.mat", "Ad", "Au64"); + var matrices = MatlabReader.ReadMatrices("./data/Matlab/collection.mat", "Ad", "Au64"); Assert.AreEqual(2, matrices.Count); foreach (var matrix in matrices) { - Assert.AreEqual(typeof(LinearAlgebra.Single.DenseMatrix), matrix.Value.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Single.DenseMatrix), matrix.Value.GetType()); } } @@ -370,13 +370,13 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadFloatNamedMatrix() { - var matrices = MatlabMatrixReader.ReadMatrices("./data/Matlab/collection.mat", "Ad"); + var matrices = MatlabReader.ReadMatrices("./data/Matlab/collection.mat", "Ad"); Assert.AreEqual(1, matrices.Count); var ad = matrices["Ad"]; Assert.AreEqual(100, ad.RowCount); Assert.AreEqual(100, ad.ColumnCount); AssertHelpers.AlmostEqual(100.431635988639f, ad.FrobeniusNorm(), 6); - Assert.AreEqual(typeof(LinearAlgebra.Single.DenseMatrix), ad.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Single.DenseMatrix), ad.GetType()); } /// @@ -385,10 +385,10 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void CanReadFloatNamedSparseMatrix() { - var matrix = MatlabMatrixReader.ReadMatrix("./data/Matlab/sparse-small.mat", "S"); + var matrix = MatlabReader.ReadMatrix("./data/Matlab/sparse-small.mat", "S"); Assert.AreEqual(100, matrix.RowCount); Assert.AreEqual(100, matrix.ColumnCount); - Assert.AreEqual(typeof(LinearAlgebra.Single.SparseMatrix), matrix.GetType()); + Assert.AreEqual(typeof (LinearAlgebra.Single.SparseMatrix), matrix.GetType()); AssertHelpers.AlmostEqual(17.6385090630805f, matrix.FrobeniusNorm(), 6); } } diff --git a/src/DataUnitTests/Matlab/MatlabWriterTests.cs b/src/DataUnitTests/Matlab/MatlabWriterTests.cs index cd4f7bb1..19f7a591 100644 --- a/src/DataUnitTests/Matlab/MatlabWriterTests.cs +++ b/src/DataUnitTests/Matlab/MatlabWriterTests.cs @@ -36,7 +36,7 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab /// Matlab matrix writer tests. /// [TestFixture] - public class MatlabMatrixWriterTests + public class MatlabWriterTests { /// /// Invalid constructor throws ArgumentException. @@ -44,8 +44,8 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void InvalidConstructorThrowsArgumentException() { - Assert.Throws(() => new MatlabMatrixWriter(string.Empty)); - Assert.Throws(() => new MatlabMatrixWriter(null)); + Assert.Throws(() => new MatlabWriter(string.Empty)); + Assert.Throws(() => new MatlabWriter(null)); } /// @@ -55,7 +55,7 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab public void WriteBadMatricesThrowsArgumentException() { var matrix = new LinearAlgebra.Single.DenseMatrix(1, 1); - var writer = new MatlabMatrixWriter("somefile3"); + var writer = new MatlabWriter("somefile3"); Assert.Throws(() => writer.WriteMatrices(new[] { matrix }, new[] { string.Empty })); Assert.Throws(() => writer.WriteMatrices(new[] { matrix }, new string[] { null })); Assert.Throws(() => writer.WriteMatrices(new[] { matrix, matrix }, new[] { "matrix" })); @@ -69,7 +69,7 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void WriteNullMatricesThrowsArgumentNullException() { - var writer = new MatlabMatrixWriter("somefile4"); + var writer = new MatlabWriter("somefile4"); Assert.Throws(() => writer.WriteMatrices(new LinearAlgebra.Single.Matrix[] { null }, new[] { "matrix" })); var matrix = new LinearAlgebra.Single.DenseMatrix(1, 1); Assert.Throws(() => writer.WriteMatrices(new LinearAlgebra.Single.Matrix[] { matrix }, null)); @@ -112,11 +112,11 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab File.Delete("testd.mat"); } - var writer = new MatlabMatrixWriter("testd.mat"); + var writer = new MatlabWriter("testd.mat"); writer.WriteMatrices(write, names); writer.Dispose(); - var read = MatlabMatrixReader.ReadMatrices("testd.mat", names); + var read = MatlabReader.ReadMatrices("testd.mat", names); Assert.AreEqual(write.Length, read.Count); @@ -167,11 +167,11 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab File.Delete("tests.mat"); } - var writer = new MatlabMatrixWriter("tests.mat"); + var writer = new MatlabWriter("tests.mat"); writer.WriteMatrices(write, names); writer.Dispose(); - var read = MatlabMatrixReader.ReadMatrices("tests.mat", names); + var read = MatlabReader.ReadMatrices("tests.mat", names); Assert.AreEqual(write.Length, read.Count); @@ -222,11 +222,11 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab File.Delete("testc.mat"); } - var writer = new MatlabMatrixWriter("testc.mat"); + var writer = new MatlabWriter("testc.mat"); writer.WriteMatrices(write, names); writer.Dispose(); - var read = MatlabMatrixReader.ReadMatrices("testc.mat", names); + var read = MatlabReader.ReadMatrices("testc.mat", names); Assert.AreEqual(write.Length, read.Count); @@ -277,11 +277,11 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab File.Delete("testz.mat"); } - var writer = new MatlabMatrixWriter("testz.mat"); + var writer = new MatlabWriter("testz.mat"); writer.WriteMatrices(write, names); writer.Dispose(); - var read = MatlabMatrixReader.ReadMatrices("testz.mat", names); + var read = MatlabReader.ReadMatrices("testz.mat", names); Assert.AreEqual(write.Length, read.Count); @@ -303,7 +303,7 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab public void WriteBadMatrixThrowsArgumentException() { var matrix = new LinearAlgebra.Single.DenseMatrix(1, 1); - var writer = new MatlabMatrixWriter("somefile1"); + var writer = new MatlabWriter("somefile1"); Assert.Throws(() => writer.WriteMatrix(matrix, string.Empty)); Assert.Throws(() => writer.WriteMatrix(matrix, null)); writer.Dispose(); @@ -315,7 +315,7 @@ namespace MathNet.Numerics.Data.UnitTests.Matlab [Test] public void WriteNullMatrixThrowsArgumentNullException() { - var writer = new MatlabMatrixWriter("somefile2"); + var writer = new MatlabWriter("somefile2"); Assert.Throws(() => writer.WriteMatrix(null, "matrix")); writer.Dispose(); } diff --git a/src/Numerics/Providers/LinearAlgebra/ILinearAlgebraProvider.cs b/src/Numerics/Providers/LinearAlgebra/ILinearAlgebraProvider.cs index 820a2328..ade69ba3 100644 --- a/src/Numerics/Providers/LinearAlgebra/ILinearAlgebraProvider.cs +++ b/src/Numerics/Providers/LinearAlgebra/ILinearAlgebraProvider.cs @@ -95,7 +95,7 @@ namespace MathNet.Numerics.Providers.LinearAlgebra ILinearAlgebraProvider { /// - /// Initialize and verify that the provided is indeed available. If not, fall back to alernatives like the managed provider + /// Initialize and verify that the provided is indeed available. If not, fall back to alternatives like the managed provider /// void InitializeVerify(); }