From 350e37219c68d4e7f9eedb76002eb3a889df3a1e Mon Sep 17 00:00:00 2001 From: Ksero Date: Fri, 15 Dec 2017 15:43:14 +0100 Subject: [PATCH 1/5] Fix another typo in the Runge-Kutta solvers (the time-step was added rather than multiplied with the slope) (#531) --- src/Numerics/OdeSolvers/RungeKutta.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Numerics/OdeSolvers/RungeKutta.cs b/src/Numerics/OdeSolvers/RungeKutta.cs index 77a65d71..6ee5c757 100644 --- a/src/Numerics/OdeSolvers/RungeKutta.cs +++ b/src/Numerics/OdeSolvers/RungeKutta.cs @@ -116,7 +116,7 @@ namespace MathNet.Numerics.OdeSolvers for (int i = 1; i < N; i++) { k1 = f(t, y0); - k2 = f(t, y0 + k1 + dt); + k2 = f(t, y0 + k1 * dt); y[i] = y0 + dt * 0.5 * (k1 + k2); t += dt; y0 = y[i]; From 564a4658fc02fc4b6273245d1851cefc8cc0b330 Mon Sep 17 00:00:00 2001 From: mjmckp Date: Sat, 6 Jan 2018 08:38:52 +1100 Subject: [PATCH 2/5] Fix for IndexOutOfRangeException in GetHashCode method in certain cases where ColumnCount > RowCount (#535) --- src/Numerics/LinearAlgebra/Storage/MatrixStorage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Numerics/LinearAlgebra/Storage/MatrixStorage.cs b/src/Numerics/LinearAlgebra/Storage/MatrixStorage.cs index a7470dc3..25297625 100644 --- a/src/Numerics/LinearAlgebra/Storage/MatrixStorage.cs +++ b/src/Numerics/LinearAlgebra/Storage/MatrixStorage.cs @@ -191,7 +191,7 @@ namespace MathNet.Numerics.LinearAlgebra.Storage for (var i = 0; i < hashNum; i++) { var col = i%ColumnCount; - var row = (i - col)/RowCount; + var row = (i - col)%RowCount; hash = hash*31 + At(row, col).GetHashCode(); } } From 9d6f59a795fd95190ffcf7040b922d9e7c8e9019 Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Fri, 5 Jan 2018 23:04:53 +0100 Subject: [PATCH 3/5] MatrixStorage: more reasonable GetHashCode #534 --- src/Numerics/LinearAlgebra/Storage/MatrixStorage.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Numerics/LinearAlgebra/Storage/MatrixStorage.cs b/src/Numerics/LinearAlgebra/Storage/MatrixStorage.cs index 25297625..3195759e 100644 --- a/src/Numerics/LinearAlgebra/Storage/MatrixStorage.cs +++ b/src/Numerics/LinearAlgebra/Storage/MatrixStorage.cs @@ -190,8 +190,13 @@ namespace MathNet.Numerics.LinearAlgebra.Storage { for (var i = 0; i < hashNum; i++) { - var col = i%ColumnCount; - var row = (i - col)%RowCount; +#if PORTABLE || NETSTANDARD + int col = i%ColumnCount; + int row = i/ColumnCount; +#else + int col; + int row = Math.DivRem(i, ColumnCount, out col); +#endif hash = hash*31 + At(row, col).GetHashCode(); } } From 1daa68fbd31d5caa136e7f2c643ea6cb4ad7ec87 Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Tue, 9 Jan 2018 20:14:58 +0100 Subject: [PATCH 4/5] BUG: Trigonometry: fix imaginary part sign of complex hyperbolic cotangent #539 --- src/Numerics/Trigonometry.cs | 4 ++-- src/UnitTests/TrigonometryTest.cs | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/Numerics/Trigonometry.cs b/src/Numerics/Trigonometry.cs index 55067d66..70c9534e 100644 --- a/src/Numerics/Trigonometry.cs +++ b/src/Numerics/Trigonometry.cs @@ -572,7 +572,7 @@ namespace MathNet.Numerics var denom = (sini * sini) + (sinhr * sinhr); - return new Complex(sinhr * Cosh(value.Real) / denom, sini * Cos(value.Imaginary) / denom); + return new Complex(sinhr * Cosh(value.Real) / denom, -sini * Cos(value.Imaginary) / denom); } /// @@ -763,4 +763,4 @@ namespace MathNet.Numerics return (inv + (inv.Square() + 1).SquareRoot()).Ln(); } } -} \ No newline at end of file +} diff --git a/src/UnitTests/TrigonometryTest.cs b/src/UnitTests/TrigonometryTest.cs index dc49e575..a428cda6 100644 --- a/src/UnitTests/TrigonometryTest.cs +++ b/src/UnitTests/TrigonometryTest.cs @@ -612,7 +612,10 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, 0.0, -1.1920928955078128e-7, 0.0)] [TestCase(8.388608e6, 1.19209289550780998537e-7, double.PositiveInfinity, double.PositiveInfinity)] [TestCase(-8.388608e6, -1.19209289550780998537e-7, double.NegativeInfinity, double.NegativeInfinity)] + [TestCase(0.5, 0.5, 0.45730415318424922, 0.54061268571315335)] [TestCase(0.5, -0.5, 0.45730415318424922, -0.54061268571315335)] + [TestCase(-0.5, 0.5, -0.45730415318424922, 0.54061268571315335)] + [TestCase(-0.5, -0.5, -0.45730415318424922, -0.54061268571315335)] public void CanComputeComplexHyperbolicSine(double real, double imag, double expectedReal, double expectedImag) { var actual = new Complex(real, imag).Sinh(); @@ -634,7 +637,10 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, 0.0, 1.0000000000000071, 0.0)] [TestCase(8.388608e6, 1.19209289550780998537e-7, double.PositiveInfinity, double.PositiveInfinity)] [TestCase(-8.388608e6, -1.19209289550780998537e-7, double.PositiveInfinity, double.PositiveInfinity)] + [TestCase(0.5, 0.5, 0.9895848833999199, 0.24982639750046154)] [TestCase(0.5, -0.5, 0.9895848833999199, -0.24982639750046154)] + [TestCase(-0.5, 0.5, 0.9895848833999199, -0.24982639750046154)] + [TestCase(-0.5, -0.5, 0.9895848833999199, 0.24982639750046154)] public void CanComputeComplexHyperbolicCosine(double real, double imag, double expectedReal, double expectedImag) { var actual = new Complex(real, imag).Cosh(); @@ -656,7 +662,10 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, 0.0, -1.1920928955078043e-7, 0.0)] [TestCase(8.388608e6, 1.19209289550780998537e-7, 1.0, 0.0)] [TestCase(-8.388608e6, -1.19209289550780998537e-7, -1.0, 0.0)] + [TestCase(0.5, 0.5, 0.56408314126749848, 0.40389645531602575)] [TestCase(0.5, -0.5, 0.56408314126749848, -0.40389645531602575)] + [TestCase(-0.5, 0.5, -0.56408314126749848, 0.40389645531602575)] + [TestCase(-0.5, -0.5, -0.56408314126749848, -0.40389645531602575)] public void CanComputeComplexHyperbolicTangent(double real, double imag, double expectedReal, double expectedImag) { var actual = new Complex(real, imag).Tanh(); @@ -678,7 +687,10 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, 0.0, -8388608.0000000574, 0.0)] [TestCase(8.388608e6, 1.19209289550780998537e-7, 1.0, 0.0)] [TestCase(-8.388608e6, -1.19209289550780998537e-7, -1.0, 0.0)] - [TestCase(0.5, -0.5, 1.1719451445243514, -0.8391395790248311)] + [TestCase(0.5, 0.5, 1.1719451445243514, -0.8391395790248311)] + [TestCase(0.5, -0.5, 1.1719451445243514, 0.8391395790248311)] + [TestCase(-0.5, 0.5, -1.1719451445243514, -0.8391395790248311)] + [TestCase(-0.5, -0.5, -1.1719451445243514, 0.8391395790248311)] public void CanComputeComplexHyperbolicCotangent(double real, double imag, double expectedReal, double expectedImag) { var actual = new Complex(real, imag).Coth(); @@ -700,7 +712,10 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, 0.0, 0.99999999999999289, 0.0)] [TestCase(8.388608e6, 1.19209289550780998537e-7, 0.0, 0.0)] [TestCase(-8.388608e6, -1.19209289550780998537e-7, -0.0, 0.0)] + [TestCase(0.5, 0.5, 0.94997886761549463, -0.23982763093808804)] [TestCase(0.5, -0.5, 0.94997886761549463, 0.23982763093808804)] + [TestCase(-0.5, 0.5, 0.94997886761549463, 0.23982763093808804)] + [TestCase(-0.5, -0.5, 0.94997886761549463, -0.23982763093808804)] public void CanComputeComplexHyperbolicSecant(double real, double imag, double expectedReal, double expectedImag) { var actual = new Complex(real, imag).Sech(); @@ -722,7 +737,10 @@ namespace MathNet.Numerics.UnitTests [TestCase(-1.19209289550780998537e-7, 0.0, -8388607.9999999978, 0.0)] [TestCase(8.388608e6, 1.19209289550780998537e-7, 0.0, 0.0)] [TestCase(-8.388608e6, -1.19209289550780998537e-7, 0.0, 0.0)] + [TestCase(0.5, 0.5, 0.91207426403881078, -1.0782296946540223)] [TestCase(0.5, -0.5, 0.91207426403881078, 1.0782296946540223)] + [TestCase(-0.5, 0.5, -0.91207426403881078, -1.0782296946540223)] + [TestCase(-0.5, -0.5, -0.91207426403881078, 1.0782296946540223)] public void CanComputeComplexHyperbolicCosecant(double real, double imag, double expectedReal, double expectedImag) { var actual = new Complex(real, imag).Csch(); From 13bf674b5ec746808678be755f49566e8f082e0b Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Sat, 13 Jan 2018 12:34:28 +0100 Subject: [PATCH 5/5] Release v3.20.1 --- .paket/Paket.Restore.targets | 272 +++++++++++++++++++++++ MathNet.Numerics.sln.DotSettings | 8 + RELEASENOTES.md | 6 + src/FSharp/AssemblyInfo.fs | 6 +- src/FSharpUnitTests/AssemblyInfo.fs | 6 +- src/Numerics/Properties/AssemblyInfo.cs | 6 +- src/UnitTests/Properties/AssemblyInfo.cs | 6 +- 7 files changed, 298 insertions(+), 12 deletions(-) create mode 100644 .paket/Paket.Restore.targets diff --git a/.paket/Paket.Restore.targets b/.paket/Paket.Restore.targets new file mode 100644 index 00000000..a86be3a1 --- /dev/null +++ b/.paket/Paket.Restore.targets @@ -0,0 +1,272 @@ + + + + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + true + $(MSBuildThisFileDirectory) + $(MSBuildThisFileDirectory)..\ + $(PaketRootPath)paket-files\paket.restore.cached + $(PaketRootPath)paket.lock + /Library/Frameworks/Mono.framework/Commands/mono + mono + + $(PaketRootPath)paket.exe + $(PaketToolsPath)paket.exe + "$(PaketExePath)" + $(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)" + + + <_PaketExeExtension>$([System.IO.Path]::GetExtension("$(PaketExePath)")) + dotnet "$(PaketExePath)" + + $(PaketRootPath)paket.bootstrapper.exe + $(PaketToolsPath)paket.bootstrapper.exe + "$(PaketBootStrapperExePath)" + $(MonoPath) --runtime=v4.0.30319 "$(PaketBootStrapperExePath)" + + + + + true + true + + + + + + + true + $(NoWarn);NU1603 + + + + + /usr/bin/shasum $(PaketRestoreCacheFile) | /usr/bin/awk '{ print $1 }' + /usr/bin/shasum $(PaketLockFilePath) | /usr/bin/awk '{ print $1 }' + + + + + + + + + + + + + $([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)')) + $([System.IO.File]::ReadAllText('$(PaketLockFilePath)')) + true + false + true + + + + + + + + + $(MSBuildProjectDirectory)\obj\$(MSBuildProjectFile).paket.references.cached + + $(MSBuildProjectFullPath).paket.references + + $(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references + + $(MSBuildProjectDirectory)\paket.references + $(MSBuildProjectDirectory)\obj\$(MSBuildProjectFile).$(TargetFramework).paket.resolved + true + references-file-or-cache-not-found + + + + + $([System.IO.File]::ReadAllText('$(PaketReferencesCachedFilePath)')) + $([System.IO.File]::ReadAllText('$(PaketOriginalReferencesFilePath)')) + references-file + false + + + + + false + + + + + true + target-framework '$(TargetFramework)' + + + + + + + + + + + + + + + + + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0]) + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1]) + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[4]) + + + %(PaketReferencesFileLinesInfo.PackageVersion) + All + + + + + $(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).paket.clitools + + + + + + + + + $([System.String]::Copy('%(PaketCliToolFileLines.Identity)').Split(',')[0]) + $([System.String]::Copy('%(PaketCliToolFileLines.Identity)').Split(',')[1]) + + + %(PaketCliToolFileLinesInfo.PackageVersion) + + + + + $(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).NuGet.Config + + + + + + + false + + + + + + <_NuspecFilesNewLocation Include="$(BaseIntermediateOutputPath)$(Configuration)\*.nuspec"/> + + + + $(MSBuildProjectDirectory)/$(MSBuildProjectFile) + true + false + true + $(BaseIntermediateOutputPath)$(Configuration) + $(BaseIntermediateOutputPath) + + + + <_NuspecFiles Include="$(AdjustedNuspecOutputPath)\*.nuspec"/> + + + + + + + + + + + + + + + + diff --git a/MathNet.Numerics.sln.DotSettings b/MathNet.Numerics.sln.DotSettings index 8e5ab65e..816b19f2 100644 --- a/MathNet.Numerics.sln.DotSettings +++ b/MathNet.Numerics.sln.DotSettings @@ -27,7 +27,10 @@ False False True + NEVER + NEVER False + NEVER False True False @@ -102,7 +105,12 @@ OTHER DEALINGS IN THE SOFTWARE. SVD TFQMR WH + True + True + True + True True + True True True <data /> diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 07c49637..f702528b 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -1,3 +1,9 @@ +### 3.20.1 - 2018-01-13 +* Bugfixes backported from v4: +* BUG: Trigonometry: Fix imaginary part sign of complex hyperbolic cotangent +* BUG: Ode Solver: fix typo in the Runge-Kutta solvers on time-step handling *~Ksero* +* BUG: fix Matrix.GetHashCode for wide matrices *~mjmckp* + ### 3.20.0 - 2017-07-15 * Optimization: non-linear optimization algorithms *~Scott Stephens, Erik Ovegard, bdodson, et al.* * Native Providers: from now on also supported in the .Net 3.5 build. diff --git a/src/FSharp/AssemblyInfo.fs b/src/FSharp/AssemblyInfo.fs index 7ce36f42..4535d34b 100644 --- a/src/FSharp/AssemblyInfo.fs +++ b/src/FSharp/AssemblyInfo.fs @@ -44,9 +44,9 @@ open System.Runtime.InteropServices [] [] -[] -[] -[] +[] +[] +[] #if PORTABLE #else diff --git a/src/FSharpUnitTests/AssemblyInfo.fs b/src/FSharpUnitTests/AssemblyInfo.fs index 9b69c0e8..b889ff7e 100644 --- a/src/FSharpUnitTests/AssemblyInfo.fs +++ b/src/FSharpUnitTests/AssemblyInfo.fs @@ -10,9 +10,9 @@ open System.Runtime.InteropServices [] [] -[] -[] -[] +[] +[] +[] #if PORTABLE #else diff --git a/src/Numerics/Properties/AssemblyInfo.cs b/src/Numerics/Properties/AssemblyInfo.cs index 97e8988e..ecf98445 100644 --- a/src/Numerics/Properties/AssemblyInfo.cs +++ b/src/Numerics/Properties/AssemblyInfo.cs @@ -45,9 +45,9 @@ using System.Runtime.InteropServices; [assembly: CLSCompliant(true)] [assembly: NeutralResourcesLanguage("en")] -[assembly: AssemblyVersion("3.20.0.0")] -[assembly: AssemblyFileVersion("3.20.0.0")] -[assembly: AssemblyInformationalVersion("3.20.0")] +[assembly: AssemblyVersion("3.20.1.0")] +[assembly: AssemblyFileVersion("3.20.1.0")] +[assembly: AssemblyInformationalVersion("3.20.1")] #if PORTABLE diff --git a/src/UnitTests/Properties/AssemblyInfo.cs b/src/UnitTests/Properties/AssemblyInfo.cs index 8e6f3d04..cd983ca4 100644 --- a/src/UnitTests/Properties/AssemblyInfo.cs +++ b/src/UnitTests/Properties/AssemblyInfo.cs @@ -9,8 +9,8 @@ using MathNet.Numerics.UnitTests; [assembly: ComVisible(false)] [assembly: Guid("04157581-63f3-447b-a277-83c6e69126a4")] -[assembly: AssemblyVersion("3.20.0.0")] -[assembly: AssemblyFileVersion("3.20.0.0")] -[assembly: AssemblyInformationalVersion("3.20.0")] +[assembly: AssemblyVersion("3.20.1.0")] +[assembly: AssemblyFileVersion("3.20.1.0")] +[assembly: AssemblyInformationalVersion("3.20.1")] [assembly: UseLinearAlgebraProvider]