Browse Source

Merge remote-tracking branch 'mathnet/master' into optimization-1

optimization-1
Christoph Ruegg 13 years ago
parent
commit
1fb3357b80
  1. 2
      .gitignore
  2. 25
      CONTRIBUTING.md
  3. 2
      CONTRIBUTORS.md
  4. 124
      MathNet.Numerics.NativeProviders.sln
  5. 43
      MathNet.Numerics.Net35Only.sln
  6. 71
      MathNet.Numerics.Net35Only.sln.DotSettings
  7. 17
      MathNet.Numerics.Portable.sln
  8. 1
      MathNet.Numerics.Portable.sln.DotSettings
  9. 4
      MathNet.Numerics.sln.DotSettings
  10. 6
      README.md
  11. 60
      RELEASENOTES.md
  12. 8
      Vagrantfile
  13. 2
      build/NuGet/nuget.proj
  14. 2
      packages/.gitattributes
  15. 36
      packages/FSharp.Formatting.1.0.15/FSharp.Formatting.1.0.15.nuspec
  16. 320
      packages/FSharp.Formatting.1.0.15/literate/StringParsing.fs
  17. 92
      packages/FSharp.Formatting.1.0.15/literate/content/tips.js
  18. 68
      packages/FSharp.Formatting.1.0.15/literate/templates/template-file.html
  19. 122
      packages/FSharp.Formatting.1.0.15/literate/templates/template-project.html
  20. 42
      packages/FsUnit.1.2.1.0/FsUnit.1.2.1.0.nuspec
  21. 52
      packages/NUnit.2.6.3/NUnit.2.6.3.nuspec
  22. BIN
      packages/TaskParallelLibrary.1.0.2856.0/TaskParallelLibrary.1.0.2856.0.nupkg
  23. 24
      packages/TaskParallelLibrary.1.0.2856.0/TaskParallelLibrary.1.0.2856.0.nuspec
  24. BIN
      packages/TaskParallelLibrary.1.0.2856.0/lib/Net35/System.Threading.chm
  25. BIN
      packages/TaskParallelLibrary.1.0.2856.0/lib/Net35/System.Threading.dll
  26. 11
      packages/TaskParallelLibrary.1.0.2856.0/lib/Net35/redist.txt
  27. 11
      packages/repositories.config
  28. 145
      src/Examples/ContinuousDistributions/TriangularDistribution.cs
  29. 1
      src/Examples/Examples.csproj
  30. 8
      src/Examples/Interpolation/AkimaSpline.cs
  31. 7
      src/Examples/Interpolation/LinearBetweenPoints.cs
  32. 5
      src/Examples/Interpolation/RationalWithPoles.cs
  33. 5
      src/Examples/Interpolation/RationalWithoutPoles.cs
  34. 10
      src/Examples/LinearAlgebra/VectorInitialization.cs
  35. 18
      src/Examples/NumberTheory.cs
  36. 6
      src/Examples/RandomNumberGeneration.cs
  37. 8
      src/Examples/Signals/Chebyshev.cs
  38. 21
      src/Examples/Signals/Equidistant.cs
  39. 10
      src/Examples/Signals/Random.cs
  40. 9
      src/Examples/SpecialFunctions/ErrorFunction.cs
  41. 6
      src/Examples/Statistics.cs
  42. 18
      src/FSharp/LinearAlgebra.Matrix.fs
  43. 14
      src/FSharp/LinearAlgebra.Vector.fs
  44. 96
      src/FSharp/Random.fs
  45. 0
      src/NativeProviders/.gitignore
  46. 0
      src/NativeProviders/ATLAS/blas.c
  47. 0
      src/NativeProviders/ATLAS/blas.h
  48. 0
      src/NativeProviders/ATLAS/lapack.cpp
  49. 0
      src/NativeProviders/Common/WindowsDLL.cpp
  50. 0
      src/NativeProviders/Common/lapack_common.h
  51. 0
      src/NativeProviders/Common/resource.h
  52. 2
      src/NativeProviders/Common/resource.rc
  53. 0
      src/NativeProviders/Common/wrapper_common.h
  54. 0
      src/NativeProviders/Linux/mkl_build.sh
  55. 0
      src/NativeProviders/MKL/blas.c
  56. 0
      src/NativeProviders/MKL/lapack.cpp
  57. 0
      src/NativeProviders/MKL/optimization.cpp
  58. 0
      src/NativeProviders/MKL/vector_functions.c
  59. 19
      src/NativeProviders/Windows/ATLAS/ATLASWrapper.vcxproj
  60. 0
      src/NativeProviders/Windows/ATLAS/ATLASWrapper.vcxproj.filters
  61. 0
      src/NativeProviders/Windows/ATLASEx/ATLASWrapper.vcproj
  62. 0
      src/NativeProviders/Windows/ATLASEx/ATLASWrapper.vcxproj
  63. 0
      src/NativeProviders/Windows/ATLASEx/ATLASWrapper.vcxproj.filters
  64. 0
      src/NativeProviders/Windows/MKL/MKLWrapper.vcproj
  65. 40
      src/NativeProviders/Windows/MKL/MKLWrapper.vcxproj
  66. 0
      src/NativeProviders/Windows/MKL/MKLWrapper.vcxproj.filters
  67. 53
      src/NativeWrappers/Windows/NativeWrappers.sln
  68. 134
      src/Numerics/Compatibility.cs
  69. 6
      src/Numerics/Complex64.cs
  70. 32
      src/Numerics/Control.cs
  71. 86
      src/Numerics/Distance.cs
  72. 14
      src/Numerics/Distributions/Bernoulli.cs
  73. 21
      src/Numerics/Distributions/Beta.cs
  74. 20
      src/Numerics/Distributions/Binomial.cs
  75. 36
      src/Numerics/Distributions/Categorical.cs
  76. 18
      src/Numerics/Distributions/Cauchy.cs
  77. 20
      src/Numerics/Distributions/Chi.cs
  78. 16
      src/Numerics/Distributions/ChiSquared.cs
  79. 14
      src/Numerics/Distributions/ContinuousUniform.cs
  80. 20
      src/Numerics/Distributions/ConwayMaxwellPoisson.cs
  81. 24
      src/Numerics/Distributions/Dirichlet.cs
  82. 14
      src/Numerics/Distributions/DiscreteUniform.cs
  83. 16
      src/Numerics/Distributions/Erlang.cs
  84. 12
      src/Numerics/Distributions/Exponential.cs
  85. 18
      src/Numerics/Distributions/FisherSnedecor.cs
  86. 52
      src/Numerics/Distributions/Gamma.cs
  87. 14
      src/Numerics/Distributions/Geometric.cs
  88. 17
      src/Numerics/Distributions/Hypergeometric.cs
  89. 16
      src/Numerics/Distributions/InverseGamma.cs
  90. 34
      src/Numerics/Distributions/InverseWishart.cs
  91. 18
      src/Numerics/Distributions/Laplace.cs
  92. 18
      src/Numerics/Distributions/LogNormal.cs
  93. 22
      src/Numerics/Distributions/MatrixNormal.cs
  94. 42
      src/Numerics/Distributions/Multinomial.cs
  95. 20
      src/Numerics/Distributions/NegativeBinomial.cs
  96. 14
      src/Numerics/Distributions/Normal.cs
  97. 20
      src/Numerics/Distributions/NormalGamma.cs
  98. 20
      src/Numerics/Distributions/Pareto.cs
  99. 7
      src/Numerics/Distributions/Poisson.cs
  100. 22
      src/Numerics/Distributions/Rayleigh.cs

2
.gitignore

@ -22,3 +22,5 @@ UpgradeLog.htm
*.vsdoc
*.XML
*.so
*.sdf
*.opensdf

25
CONTRIBUTING.md

@ -8,18 +8,21 @@ Math.NET Numerics is driven by the community and contributors like you. I'm exci
## Getting Started
- Make sure you have a [GitHub account](https://github.com/signup/free), it's free.
- Please configure a proper name and email address in git ([how to](https://help.github.com/articles/set-up-git)).
- Please configure a proper name and email address in git ([how to](https://help.github.com/articles/set-up-git)). Real names are preferred, but it is acceptable to use an alias or even an obviously fake email address if you wish not to be contacted, as long as something is explicitly configured (not the default).
- Fork the [mainline repository](https://github.com/mathnet/mathnet-numerics) on GitHub ([how to](https://help.github.com/articles/fork-a-repo)).
We use the [Fork & Pull Model](https://help.github.com/articles/using-pull-requests/), as common for GitHub projects. If you've already contributed to another GitHub project then you're all set. If not, [here is another introduction](https://gun.io/blog/how-to-github-fork-branch-and-pull-request/).
**New Files:**
When adding or renaming files in the F# projects, please make sure you also add them to the Portable projects in the same order (See the MathNet.Numerics.Portable.sln solution). This is a bit tedious but we have not found a better solution yet.
**C# Solutions, Projects and Files**
We have two kind of C# projects: primary (*Numerics.csproj, UnitTests.csproj*) and secondary (*Numerics-xy.csproj, UnitTests-xy.csproj*). The primary ones are the common VisualStudio project files you usually work with. The secondary projects on the other hand are not intended to be modified and include all files automatically. Whenever you need to add, remove or move a file, please do so in the primary projects only. In most cases we recommend to work with the `MathNet.Numerics.sln` solution which only includes primary projects anyway - except when working on and testing portability/compatibility.
**Separate Branch per Pull Request:**
**F# Projects**
F# does not support the wildcard approach of the C# projects by design, so whenever you add, remove or move an F# file please manually update all F# projects accordingly, including the secondary platform specific ones in the `MathNet.Numerics.Portable.sln` solution. This is a bit tedious but we have not found a better solution yet.
**Separate Branch per Pull Request**
We recommend that you create a separate branch for each pull request, as opposed to using master. This makes it much easier to continue working on a pull request even after it has been opened on GitHub. Remember that GitHub automatically includes all future commits of the same branch to the pull request.
**Focused:**
**Focused**
We prefer a couple small pull requests over a single large one that targets multiple things at once.
### When fixing a bug ...
@ -28,7 +31,7 @@ If you have a good idea how to fix it, directly open a pull request. Otherwise y
### When extending features ...
If you're extending some feature which is similar and close to existing code, for example adding a new correlation function in addition to the existing Pearson correlation coefficient, it's fine to directly open a pull request. We're likely to accept such pulls.
If you're extending some feature which is similar and close to existing code, for example adding a new probability distribution or a new Bessel-related special function, it's fine to directly open a pull request. We're likely to accept such pulls.
### When adding new features ...
@ -36,13 +39,21 @@ If you intend to add completely new features, say some spatial routines for geom
Note that your work does not need to be finished or complete at the time you open the pull request (but please do mention this in the message), as GitHub pull requests are an excellent tool to discuss an early prototype or skeleton before it is fully implemented.
### When you wish to contribute but do not know where to start ...
Issues marked with "up-for-grabs" should be good candidates for a first contribution, but you can start with whatever you wish. If you decide to work on an existing issue, consider to add a comment to mention you're working on it.
What works very well is to try to build something with real world data that uses Math.NET Numerics: you either end up with a nice example that we would love to include or refer to, or you run into things which are missing, unintuitive, broken or just a bit weird, which we'd love to hear about so we (or you?) can fix it.
Should you stumble on weird English grammar or wording please do fix it - most of the contributors are not native English speakers. That includes this document.
## What to Avoid
**Code Reformatting and Refactoring:**
Please avoid starting with a major refactoring or any code reformatting without talking to us first.
**Breaking Compatibility:**
We try to follow [semantic versioning](http://semver.org/), meaning that we cannot break compatibility until the next major version. Since Numerics intentionally permits straight access to raw algorithms, a lot of member declarations are public and thus cannot be modified. Instead of breaking compatibility, it is often possible to create a new better version side by side and mark the original implementation as obsolete and scheduled for removal on the next major version.
We try to follow [semantic versioning](http://semver.org/), meaning that we cannot break compatibility until the next major version. Since Numerics intentionally permits straight access to raw algorithms, a lot of member declarations are public and thus cannot be modified. Instead of breaking compatibility, it is often possible to create a new better version side by side though and mark the original implementation as obsolete and scheduled for removal on the next major version.
**Merges:**
Please avoid merging mainline back into your pull request branch. If you need to leverage some changes recently added to mainline, consider to rebase instead. In other words, please make sure your commits sit directly on top of a recent mainline master.

2
CONTRIBUTORS.md

@ -28,10 +28,12 @@ Feel free to add a link to your personal site/blog and/or twitter handle.*
- Artyom Baranovskiy
- Phil Cleveland (Phil)
- Scott Stephens
- Superbest
- Patrick van der Velde
- Robin Neatherway
- Anders Gustafsson (cureos)
- Andrew Kazyrevich
- Ethar Alali
- Iain McDonald (lifebeyondfife)
- Candy Chiu
- Gauthier Segay

124
MathNet.Numerics.NativeProviders.sln

@ -0,0 +1,124 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{5A0892FF-82CE-40FC-BCE1-73810C615F52}"
ProjectSection(SolutionItems) = preProject
src\NativeProviders\Common\lapack_common.h = src\NativeProviders\Common\lapack_common.h
src\NativeProviders\Common\resource.h = src\NativeProviders\Common\resource.h
src\NativeProviders\Common\resource.rc = src\NativeProviders\Common\resource.rc
src\NativeProviders\Common\WindowsDLL.cpp = src\NativeProviders\Common\WindowsDLL.cpp
src\NativeProviders\Common\wrapper_common.h = src\NativeProviders\Common\wrapper_common.h
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MKL", "src\NativeProviders\Windows\MKL\MKLWrapper.vcxproj", "{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ATLAS", "src\NativeProviders\Windows\ATLAS\ATLASWrapper.vcxproj", "{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Numerics", "src\Numerics\Numerics.csproj", "{B7CAE5F4-A23F-4438-B5BE-41226618B695}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests-MKL", "src\UnitTests\UnitTests-MKL.csproj", "{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|Win32 = Release|Win32
Release|x64 = Release|x64
Release-Signed|Any CPU = Release-Signed|Any CPU
Release-Signed|Mixed Platforms = Release-Signed|Mixed Platforms
Release-Signed|Win32 = Release-Signed|Win32
Release-Signed|x64 = Release-Signed|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Debug|Any CPU.ActiveCfg = Debug|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Debug|Win32.ActiveCfg = Debug|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Debug|Win32.Build.0 = Debug|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Debug|x64.ActiveCfg = Debug|x64
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Debug|x64.Build.0 = Debug|x64
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Release|Any CPU.ActiveCfg = Release|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Release|Mixed Platforms.Build.0 = Release|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Release|Win32.ActiveCfg = Release|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Release|Win32.Build.0 = Release|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Release|x64.ActiveCfg = Release|x64
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Release|x64.Build.0 = Release|x64
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Release-Signed|Any CPU.ActiveCfg = Release|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Release-Signed|Mixed Platforms.ActiveCfg = Release|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Release-Signed|Mixed Platforms.Build.0 = Release|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Release-Signed|Win32.ActiveCfg = Release|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Release-Signed|Win32.Build.0 = Release|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Release-Signed|x64.ActiveCfg = Release|x64
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Release-Signed|x64.Build.0 = Release|x64
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Debug|Any CPU.ActiveCfg = Debug|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Debug|Win32.ActiveCfg = Debug|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Debug|x64.ActiveCfg = Debug|x64
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Release|Any CPU.ActiveCfg = Release|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Release|Win32.ActiveCfg = Release|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Release|x64.ActiveCfg = Release|x64
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Release-Signed|Any CPU.ActiveCfg = Release|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Release-Signed|Mixed Platforms.ActiveCfg = Release|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Release-Signed|Mixed Platforms.Build.0 = Release|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Release-Signed|Win32.ActiveCfg = Release|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Release-Signed|Win32.Build.0 = Release|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Release-Signed|x64.ActiveCfg = Release|x64
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Release-Signed|x64.Build.0 = Release|x64
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Debug|Win32.ActiveCfg = Debug|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Debug|Win32.Build.0 = Debug|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Debug|x64.ActiveCfg = Debug|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Debug|x64.Build.0 = Debug|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Release|Any CPU.Build.0 = Release|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Release|Win32.ActiveCfg = Release|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Release|Win32.Build.0 = Release|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Release|x64.ActiveCfg = Release|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Release|x64.Build.0 = Release|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Release-Signed|Any CPU.ActiveCfg = Release-Signed|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Release-Signed|Any CPU.Build.0 = Release-Signed|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Release-Signed|Mixed Platforms.ActiveCfg = Release-Signed|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Release-Signed|Mixed Platforms.Build.0 = Release-Signed|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Release-Signed|Win32.ActiveCfg = Release-Signed|Any CPU
{B7CAE5F4-A23F-4438-B5BE-41226618B695}.Release-Signed|x64.ActiveCfg = Release-Signed|Any CPU
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Debug|Win32.ActiveCfg = Debug|x86
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Debug|Win32.Build.0 = Debug|x86
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Debug|x64.ActiveCfg = Debug|x64
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Debug|x64.Build.0 = Debug|x64
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Release|Any CPU.Build.0 = Release|Any CPU
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Release|Win32.ActiveCfg = Release|x86
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Release|Win32.Build.0 = Release|x86
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Release|x64.ActiveCfg = Release|x64
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Release|x64.Build.0 = Release|x64
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Release-Signed|Any CPU.ActiveCfg = Release|Any CPU
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Release-Signed|Any CPU.Build.0 = Release|Any CPU
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Release-Signed|Mixed Platforms.ActiveCfg = Release|Any CPU
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Release-Signed|Mixed Platforms.Build.0 = Release|Any CPU
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Release-Signed|Win32.ActiveCfg = Release|Any CPU
{3515A344-AB5F-41C7-A14C-04A79B3FFAB1}.Release-Signed|x64.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

43
MathNet.Numerics.Net35Only.sln

@ -0,0 +1,43 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Readme", "Readme", "{C2F37492-38AE-4186-8A7F-17B0B080942C}"
ProjectSection(SolutionItems) = preProject
CONTRIBUTING.md = CONTRIBUTING.md
CONTRIBUTORS.md = CONTRIBUTORS.md
LICENSE.md = LICENSE.md
MAINTAINING.md = MAINTAINING.md
README.md = README.md
RELEASENOTES.md = RELEASENOTES.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Numerics-Net35", "src\Numerics\Numerics-Net35.csproj", "{E54E712D-EB6B-4FBF-B29A-6BB95E719BAC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests-Net35", "src\UnitTests\UnitTests-Net35.csproj", "{9014A0CE-725D-4718-918C-923C0CA19FEE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Release-Signed|Any CPU = Release-Signed|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E54E712D-EB6B-4FBF-B29A-6BB95E719BAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E54E712D-EB6B-4FBF-B29A-6BB95E719BAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E54E712D-EB6B-4FBF-B29A-6BB95E719BAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E54E712D-EB6B-4FBF-B29A-6BB95E719BAC}.Release|Any CPU.Build.0 = Release|Any CPU
{E54E712D-EB6B-4FBF-B29A-6BB95E719BAC}.Release-Signed|Any CPU.ActiveCfg = Release-Signed|Any CPU
{E54E712D-EB6B-4FBF-B29A-6BB95E719BAC}.Release-Signed|Any CPU.Build.0 = Release-Signed|Any CPU
{9014A0CE-725D-4718-918C-923C0CA19FEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9014A0CE-725D-4718-918C-923C0CA19FEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9014A0CE-725D-4718-918C-923C0CA19FEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9014A0CE-725D-4718-918C-923C0CA19FEE}.Release|Any CPU.Build.0 = Release|Any CPU
{9014A0CE-725D-4718-918C-923C0CA19FEE}.Release-Signed|Any CPU.ActiveCfg = Release|Any CPU
{9014A0CE-725D-4718-918C-923C0CA19FEE}.Release-Signed|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

71
MathNet.Numerics.Net35Only.sln.DotSettings

@ -0,0 +1,71 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Full_0020Cleanup_0020_0028Math_002ENET_0029/@EntryIndexedValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;Profile name="Full Cleanup (Math.NET)"&gt;&lt;CSArrangeThisQualifier&gt;True&lt;/CSArrangeThisQualifier&gt;&lt;CSRemoveCodeRedundancies&gt;True&lt;/CSRemoveCodeRedundancies&gt;&lt;CSUseAutoProperty&gt;True&lt;/CSUseAutoProperty&gt;&lt;CSMakeFieldReadonly&gt;True&lt;/CSMakeFieldReadonly&gt;&lt;CSUpdateFileHeader&gt;True&lt;/CSUpdateFileHeader&gt;&lt;CSOptimizeUsings&gt;&lt;OptimizeUsings&gt;True&lt;/OptimizeUsings&gt;&lt;EmbraceInRegion&gt;False&lt;/EmbraceInRegion&gt;&lt;RegionName&gt;&lt;/RegionName&gt;&lt;/CSOptimizeUsings&gt;&lt;CSShortenReferences&gt;True&lt;/CSShortenReferences&gt;&lt;CSReformatCode&gt;True&lt;/CSReformatCode&gt;&lt;XMLReformatCode&gt;True&lt;/XMLReformatCode&gt;&lt;CssAlphabetizeProperties&gt;True&lt;/CssAlphabetizeProperties&gt;&lt;CssReformatCode&gt;True&lt;/CssReformatCode&gt;&lt;JsReformatCode&gt;True&lt;/JsReformatCode&gt;&lt;JsInsertSemicolon&gt;True&lt;/JsInsertSemicolon&gt;&lt;VBFormatDocComments&gt;True&lt;/VBFormatDocComments&gt;&lt;VBReformatCode&gt;True&lt;/VBReformatCode&gt;&lt;VBShortenReferences&gt;True&lt;/VBShortenReferences&gt;&lt;VBOptimizeImports&gt;True&lt;/VBOptimizeImports&gt;&lt;HtmlReformatCode&gt;True&lt;/HtmlReformatCode&gt;&lt;AspOptimizeRegisterDirectives&gt;True&lt;/AspOptimizeRegisterDirectives&gt;&lt;CSReorderTypeMembers&gt;True&lt;/CSReorderTypeMembers&gt;&lt;CSUseVar&gt;&lt;BehavourStyle&gt;CAN_CHANGE_BOTH&lt;/BehavourStyle&gt;&lt;LocalVariableStyle&gt;IMPLICIT_WHEN_INITIALIZER_HAS_TYPE&lt;/LocalVariableStyle&gt;&lt;ForeachVariableStyle&gt;ALWAYS_EXPLICIT&lt;/ForeachVariableStyle&gt;&lt;/CSUseVar&gt;&lt;/Profile&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">Full Cleanup (Math.NET)</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_LINQ_QUERY/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_ARGUMENT/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_ARRAY_AND_OBJECT_INITIALIZER/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_EXPRESSION/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_PARAMETER/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTLINE_TYPE_PARAMETER_CONSTRAINS/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTLINE_TYPE_PARAMETER_LIST/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/EXPLICIT_PRIVATE_MODIFIER/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_ANONYMOUS_METHOD_BLOCK/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_EMBRACED_INITIALIZER_BLOCK/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/LINE_FEED_AT_FILE_END/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_BEFORE_BINARY_OPSIGN/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LINES/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">&lt;copyright file="$FILENAME$" company="Math.NET"&gt;&#xD;
Math.NET Numerics, part of the Math.NET Project&#xD;
http://numerics.mathdotnet.com&#xD;
http://github.com/mathnet/mathnet-numerics&#xD;
http://mathnetnumerics.codeplex.com&#xD;
&#xD;
Copyright (c) 2009-$CURRENT_YEAR$ Math.NET&#xD;
&#xD;
Permission is hereby granted, free of charge, to any person&#xD;
obtaining a copy of this software and associated documentation&#xD;
files (the "Software"), to deal in the Software without&#xD;
restriction, including without limitation the rights to use,&#xD;
copy, modify, merge, publish, distribute, sublicense, and/or sell&#xD;
copies of the Software, and to permit persons to whom the&#xD;
Software is furnished to do so, subject to the following&#xD;
conditions:&#xD;
&#xD;
The above copyright notice and this permission notice shall be&#xD;
included in all copies or substantial portions of the Software.&#xD;
&#xD;
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,&#xD;
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES&#xD;
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND&#xD;
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT&#xD;
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,&#xD;
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING&#xD;
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR&#xD;
OTHER DEALINGS IN THE SOFTWARE.&#xD;
&lt;/copyright&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CDF/@EntryIndexedValue">CDF</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DFT/@EntryIndexedValue">DFT</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=FFT/@EntryIndexedValue">FFT</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ILU/@EntryIndexedValue">ILU</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ILUTP/@EntryIndexedValue">ILUTP</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LU/@EntryIndexedValue">LU</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MAE/@EntryIndexedValue">MAE</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MC/@EntryIndexedValue">MC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MCMC/@EntryIndexedValue">MCMC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MILU/@EntryIndexedValue">MILU</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MSE/@EntryIndexedValue">MSE</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PDF/@EntryIndexedValue">PDF</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=QR/@EntryIndexedValue">QR</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SAD/@EntryIndexedValue">SAD</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SAS/@EntryIndexedValue">SAS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SPSS/@EntryIndexedValue">SPSS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SSD/@EntryIndexedValue">SSD</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SVD/@EntryIndexedValue">SVD</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TFQMR/@EntryIndexedValue">TFQMR</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=WH/@EntryIndexedValue">WH</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue">&lt;data /&gt;</s:String>
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters /&gt;&lt;/data&gt;</s:String></wpf:ResourceDictionary>

17
MathNet.Numerics.Portable.sln

@ -48,6 +48,10 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharpUnitTests-Portable47"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharpUnitTests-Portable136", "src\FSharpUnitTests\FSharpUnitTests-Portable136.fsproj", "{1A8315AC-BCDA-4294-B994-FDC4FED45BEE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Numerics-Net35", "src\Numerics\Numerics-Net35.csproj", "{E54E712D-EB6B-4FBF-B29A-6BB95E719BAC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests-Net35", "src\UnitTests\UnitTests-Net35.csproj", "{9014A0CE-725D-4718-918C-923C0CA19FEE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -129,6 +133,18 @@ Global
{1A8315AC-BCDA-4294-B994-FDC4FED45BEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A8315AC-BCDA-4294-B994-FDC4FED45BEE}.Release|Any CPU.Build.0 = Release|Any CPU
{1A8315AC-BCDA-4294-B994-FDC4FED45BEE}.Release-Signed|Any CPU.ActiveCfg = Release|Any CPU
{E54E712D-EB6B-4FBF-B29A-6BB95E719BAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E54E712D-EB6B-4FBF-B29A-6BB95E719BAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E54E712D-EB6B-4FBF-B29A-6BB95E719BAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E54E712D-EB6B-4FBF-B29A-6BB95E719BAC}.Release|Any CPU.Build.0 = Release|Any CPU
{E54E712D-EB6B-4FBF-B29A-6BB95E719BAC}.Release-Signed|Any CPU.ActiveCfg = Release-Signed|Any CPU
{E54E712D-EB6B-4FBF-B29A-6BB95E719BAC}.Release-Signed|Any CPU.Build.0 = Release-Signed|Any CPU
{9014A0CE-725D-4718-918C-923C0CA19FEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9014A0CE-725D-4718-918C-923C0CA19FEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9014A0CE-725D-4718-918C-923C0CA19FEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9014A0CE-725D-4718-918C-923C0CA19FEE}.Release|Any CPU.Build.0 = Release|Any CPU
{9014A0CE-725D-4718-918C-923C0CA19FEE}.Release-Signed|Any CPU.ActiveCfg = Release|Any CPU
{9014A0CE-725D-4718-918C-923C0CA19FEE}.Release-Signed|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -140,6 +156,7 @@ Global
{104E9129-FDC3-43CF-8687-9774C6D8C6C2} = {4D50FB34-10BC-495A-8B2F-482E34B4D771}
{90CE8E32-354E-4728-8FE6-87342F469321} = {4D50FB34-10BC-495A-8B2F-482E34B4D771}
{1A8315AC-BCDA-4294-B994-FDC4FED45BEE} = {4D50FB34-10BC-495A-8B2F-482E34B4D771}
{9014A0CE-725D-4718-918C-923C0CA19FEE} = {4D50FB34-10BC-495A-8B2F-482E34B4D771}
{8239A6FF-1EF3-4DA4-A860-95C392DD6899} = {49EE74BD-301F-4C3B-B76A-07F90CC88CE7}
{BC81EA37-8EE6-4BF9-B8A9-B30497AEF8B1} = {49EE74BD-301F-4C3B-B76A-07F90CC88CE7}
EndGlobalSection

1
MathNet.Numerics.Portable.sln.DotSettings

@ -66,5 +66,6 @@ OTHER DEALINGS IN THE SOFTWARE.&#xD;
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SVD/@EntryIndexedValue">SVD</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TFQMR/@EntryIndexedValue">TFQMR</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=WH/@EntryIndexedValue">WH</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue">&lt;data /&gt;</s:String>
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters /&gt;&lt;/data&gt;</s:String></wpf:ResourceDictionary>

4
MathNet.Numerics.sln.DotSettings

@ -15,6 +15,8 @@
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/LINE_FEED_AT_FILE_END/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AFTER_TYPECAST_PARENTHESES/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_WITHIN_SINGLE_LINE_ARRAY_INITIALIZER_BRACES/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_BEFORE_BINARY_OPSIGN/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LINES/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">&lt;copyright file="$FILENAME$" company="Math.NET"&gt;&#xD;
@ -56,6 +58,7 @@ OTHER DEALINGS IN THE SOFTWARE.&#xD;
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MC/@EntryIndexedValue">MC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MCMC/@EntryIndexedValue">MCMC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MILU/@EntryIndexedValue">MILU</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MKL/@EntryIndexedValue">MKL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MSE/@EntryIndexedValue">MSE</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PDF/@EntryIndexedValue">PDF</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=QR/@EntryIndexedValue">QR</s:String>
@ -66,5 +69,6 @@ OTHER DEALINGS IN THE SOFTWARE.&#xD;
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SVD/@EntryIndexedValue">SVD</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TFQMR/@EntryIndexedValue">TFQMR</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=WH/@EntryIndexedValue">WH</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue">&lt;data /&gt;</s:String>
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters /&gt;&lt;/data&gt;</s:String></wpf:ResourceDictionary>

6
README.md

@ -3,11 +3,11 @@ Math.NET Numerics
Math.NET Numerics is an opensource **numerical library for .Net, Silverlight and Mono**.
Math.NET Numerics is the numerical foundation of the Math.NET project, aiming to provide methods and algorithms for numerical computations in science, engineering and every day use. Covered topics include special functions, linear algebra, probability models, random numbers, statistics, interpolation, integration, curve fitting, integral transforms (FFT) and more.
Math.NET Numerics is the numerical foundation of the Math.NET initiative, aiming to provide methods and algorithms for numerical computations in science, engineering and every day use. Covered topics include special functions, linear algebra, probability models, random numbers, statistics, interpolation, integration, regression, curve fitting, integral transforms (FFT) and more.
In addition to the core .NET package (which is written entirely in C#), Numerics specifically supports F# 3.0 with idiomatic extension modules and maintains mathematical data structures like BigRational that originated in the F# PowerPack. If a performance boost is needed, the managed-code provider backing its linear algebra routines and decompositions can be exchanged with wrappers for optimized native implementations such as Intel MKL.
In addition to the core .NET package (which is written entirely in C#), Numerics specifically supports F# 3.0 and 3.1 with idiomatic extension modules and maintains mathematical data structures like BigRational that originated in the F# PowerPack. If a performance boost is needed, the managed-code provider backing its linear algebra routines and decompositions can be exchanged with wrappers for optimized native implementations such as Intel MKL.
Supports Mono and .NET 4.0 on Linux, Mac and Windows, the portable version also Silverlight 5, WindowsPhone 8 and .NET for Windows Store apps.
Supports Mono and .NET 4.0 and 3.5 on Linux, Mac and Windows, the portable build (PCL) also Silverlight 5, Windows Phone 8, .NET for Windows Store apps and Xamarin Android/iOS.
Math.NET Numerics is covered under the terms of the [MIT/X11](http://mathnetnumerics.codeplex.com/license) license. You may therefore link to it and use it in both opensource and proprietary software projects. See also the [license](LICENSE.md) file in the root folder.

60
RELEASENOTES.md

@ -8,7 +8,7 @@ Math.NET Numerics Release Notes
NuGet Packages, available in the [NuGet Gallery](https://nuget.org/profiles/mathnet/):
- `MathNet.Numerics` - core package, including both .Net 4 and portable builds
- `MathNet.Numerics` - core package, including .Net 4, .Net 3.5 and portable/PCL builds
- `MathNet.Numerics.FSharp` - optional extensions for a better F# experience
- `MathNet.Numerics.Data.Text` - NEW: optional extensions for text-based matrix input/output (CSV for now)
- `MathNet.Numerics.Data.Matlab` - NEW: optional extensions for MATLAB matrix file input/output
@ -26,7 +26,13 @@ Zip Packages, available on [CodePlex](http://mathnetnumerics.codeplex.com/releas
- Binaries - core package and F# extensions, including both .Net 4 and portable builds
- Signed Binaries - strong-named version of the core package *(not recommended)*
Over time some members and classes have been replaced with more suitable alternatives. In order to maintain compatibility, such parts are not removed immediately but instead marked with the **Obsolete**-attribute. We strongly recommend to follow the instructions in the attribute text whenever you find any code calling an obsolete member, since we *do* intend to remove them at the next *major* release, v3.0.
Supported Platforms:
- .Net 4.0, .Net 3.5 and Mono: Windows, Linux and Mac.
- PCL Portable Profiles 47 and 136: Silverlight 5, Windows Phone 8, .NET for Windows Store apps (Metro).
- PCL/Xamarin: Andoid, iOS
Over time some members and classes have been replaced with more suitable alternatives. In order to maintain compatibility, such parts are not removed immediately but instead marked with the **Obsolete**-attribute. We strongly recommend to follow the instructions in the attribute text whenever you find any code calling an obsolete member, since we *do* intend to remove them at the next *major* release.
v3.0.0 - To Be Announced
------------------------
@ -35,7 +41,7 @@ See also: [Towards Math.NET Numerics Version 3](http://christoph.ruegg.name/blog
Multiple alpha builds have been made available as NuGet pre-release packages. There are likely more to come as we still have a lot to do; and at least a beta before the final release. All information provided here regarding v3 is preliminary and incomplete.
- All obsolete code has been removed (-4% LoC despite new features).
- All obsolete code has been removed.
- Reworked redundancies, inconsistencies and unfortunate past design choices.
- Significant namespace simplifications (-30%).
@ -52,10 +58,14 @@ Changes as of now:
- F#: all functions in the modules now fully generic, including the `matrix` function.
- F#: `SkipZeros` instead of the cryptic `nz` suffix for clarity.
- Add missing scalar-matrix routines.
- Optimized mixed dense-diagonal and diagonal-dense operations (500x faster on 250k set).
- More reasonable choice of return structure on mixed operations (e.g. dense+diagonal).
- Add point-wise infix operators `.*`, `./`, `.%` where supported (F#)
- Vectors explicitly provide proper L1, L2 and L-infinity norms.
- All norms return the result as double (instead of the specific value type of the matrix/vector).
- Matrix L-infinity norm now cache-optimized (8-10x faster).
- Vectors have a `ConjugateDotProduct` in addition to `DotProduct`.
- `Matrix.ConjugateTransposeAndMultiply` and variants.
- Matrix Factorization types fully generic, easily accessed by new `Matrix<T>` member methods (replacing the extension methods). Discrete implementations no longer visible.
- QR factorization is thin by default.
- Thin QR factorization uses MKL if enabled for all types (previously just `double`)
@ -70,19 +80,27 @@ Changes as of now:
- Matrix/Vector creation routines have been simplified and usually no longer require explicit dimensions. New variants to create diagonal matrices, or such where all fields have the same value. All functions that take a params array now have an overload accepting an enumerable (e.g. `OfColumnVectors`).
- Generic Matrix/Vector creation using builders, e.g. `Matrix<double>.Build.DenseOfEnumerable(...)`
- Create a matrix from a 2D-array of matrices (top-left aligned within the grid).
- Create a matrix or vector with the same structural type as an example (`.Build.SameAs(...)`)
- Removed non-static Matrix/Vector.CreateMatrix/CreateVector routines (no longer needed)
- Add Vector.OfArray (copying the array, consistent with Matrix.OfArray - you can still use the dense vector constructor if you want to use the array directly without copying).
- More convenient and one more powerful overload of `Matrix.SetSubMatrix`.
- Matrices/Vectors expose whether storage is dense with a new IsDense property.
- Various minor performance work.
- Matrix.ClearSubMatrix no longer throws on 0 or negative col/row count (nop)
- BUG: Fix bug in routine to copy a vector into a sub-row of a matrix.
### Statistics
- Pearson and Spearman correlation matrix of a set of arrays.
- Spearman ranked correlation optimized (4x faster on 100k set)
- Single-pass `MeanVariance` method (as used often together).
- Some overloads for single-precision values.
- Add `Ranks`, `QuantileRank` and `EmpiricalCDF`.
### Probability Distributions
- New Trigangular distributionb *~Superbest*
- Add InvCDF to Gamma distribution.
- Major API cleanup, including xml docs
- Xml doc and ToString now use well-known symbols for the parameters.
- Direct static exposure of distributions functions (PDF, CDF, sometimes also InvCDF).
@ -92,31 +110,61 @@ Changes as of now:
- Simpler and more composable random sampling from distributions.
- BUG: Fix hyper-geometric CDF semantics, clarify distribution parameters.
### Random Number Generators ###
- Thread-safe System.Random available again as `SystemRandomSource`.
- Fast and simple to use static `SystemRandomSource.Doubles` routine with lower randomness guarantees.
- Shared `SystemRandomSource.Default` and `MersenneTwister.Default` instances to skip expensive initialization.
- Using thread-safe random source by default in distributions, Generate, linear algebra etc.
- Tests always use seeded RNGs for reproducability.
- F#: direct sampling routines in the `Random` module, also including default and shared instances.
### Linear Regression
- Reworked `Fit` class, supporting more simple scenarios.
- New `.LinearRegression` namespace with more options.
- Better support for simple regression in multiple dimensions.
- Goodness of Fit: R, RSquared *~Ethar Alali*
- Weighted polynomial and multi-dim fitting.
- Use more efficient LA routines *~Thomas Ibel*
### Interpolation ###
- Return tuples instead of out parameter.
- Reworked splines, drop complicated and limiting inheritance design. More functional approach.
- More efficient implementation for non-cubic splines (especially linear spline).
- `Differentiate2` instead of `DifferentiateAll`.
- Definite `Integrate(a,b)` in addition to existing indefinite `Integrate(t)`.
- Use more common names in `Interpolate` facade, e.g. "Spline" is a well known name.
### Build & Packages
- NuGet packages now also include the PCL portable profile 47 (.Net 4.5, Silverlight 5, Windows 8) in addition to the normal .Net 4.0 build and PCL profile 136 (.Net 4.0, WindowsPhone 8, Silverlight 5, Windows 8) as before. Profile 47 uses `System.Numerics` for complex numbers, among others, which is not available in profile 136.
- NuGet packages now also include a .Net 3.5 build of the core library.
- IO libraries have been removed, replaced with new `.Data` packages (see list on top).
- Alternative strong-named versions of more NuGet packages (mostly the F# extensions for now), with the `.Signed` suffix.
- Reworked solution structure so it works in both Visual Studio 11 (2012) and 12 (2013).
- We can now run the full unit test suite against the portable builds as well.
- Native Provider development has been reintegrated into the main repository; we can now directly run all unit tests against local native provider builds.
### Misc
- New distance functions in `Distance`: euclidean, manhattan, chebychev distance of arrays or generic vectors. SAD, MAE, SSD, MSE metrics. Hamming distance.
- Interpolation: return tuple instead of out parameter
- New distance functions in `Distance`: euclidean, manhattan, chebychev distance of arrays or generic vectors. SAD, MAE, SSD, MSE metrics. Pearson's, Canberra and Minkowski distance. Hamming distance.
- Integration: simplification of the double-exponential transformation api design.
- Windows: ported windowing functions from Neodym (Hamming, Hann, Cosine, Lanczos, Gauss, Blackmann, Bartlett, ...)
- Generate: ported synthetic data generation and sampling routines from Neodym (includes all from old Signals namespace)
- Euclid: modulus vs remainder, integer theory (includes all from old NumberTheory namespace).
- Root Finding: explicit for Chebychev polynomials.
- Excel Functions: TDIST, GAMMADIST, GAMMAINV, QUARTILE, PERCENTRANK.
- More robust complex Asin/Acos for large real numbers.
- Complex: common short names for Exp, Ln, Log10, Log.
- Complex: fix issue where a *negative zero* may flip the sign in special cases (like `Atanh(2)`, where incidentally MATLAB and Mathematica do not agree on the sign either).
- Trig functions: common short names instead of very long names.
- Trig functions: common short names instead of very long names. Add sinc function.
- Special Functions: Increase max iterations in BetaRegularized for large arguments.
- Special Functions: new `GammaLowerRegularizedInv`.
- Precision: reworked, now much more consistent. **If you use `AlmostEqual` with numbers-between/ULP semantics, please do review your code to make sure you're still using the expected variant!**. If you use the decimal-places semantics, you may need to decrement the digits argument to get the same behavior as before.
- Much less null checks, our code generally only throws `ArgumentNullException` if an unexpected null argument would *not* have caused an immediate `NullReferenceException`.
- Tests now have category attributes (to selectively run or skip categories).
v2.6.2 - October 21, 2013
-------------------------

8
Vagrantfile

@ -2,14 +2,14 @@
Vagrant.configure("2") do |config|
config.vm.box = "wheezy64-mono3.0.10-fsharp3.0.27"
config.vm.box_url = "https://dl.dropboxusercontent.com/s/uelesklqouaw1gl/wheezy64-mono3.0.10-fsharp3.0.27-virtualbox.box"
config.vm.box = "wheezy64-mono3.2.5-fsharp3.1-dev"
config.vm.box_url = "https://skydrive.live.com/redir.aspx?cid=84f3672f8cda3e91&resid=84F3672F8CDA3E91!29372&parid=84F3672F8CDA3E91!28978&authkey=!ABWHPlJFVtdF4bA"
# default is only 384 MB RAM, 1 CPU in that box - we need some more
config.vm.provider :virtualbox do |vb|
vb.gui = false
vb.customize ["modifyvm", :id, "--memory", "1024"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
vb.customize ["modifyvm", :id, "--memory", "4096"]
vb.customize ["modifyvm", :id, "--cpus", "4"]
end
# Shell Provisioning external:

2
build/NuGet/nuget.proj

@ -17,6 +17,7 @@
<ItemGroup>
<NumericsNet40 Include="$(OutLib)/Net40/MathNet.Numerics.dll;$(OutLib)/Net40/MathNet.Numerics.pdb;$(OutLib)/Net40/MathNet.Numerics.xml" />
<NumericsNet35 Include="$(OutLib)/Net35/MathNet.Numerics.dll;$(OutLib)/Net35/MathNet.Numerics.pdb;$(OutLib)/Net35/MathNet.Numerics.xml" />
<NumericsProfile47 Include="$(OutLib)/Profile47/MathNet.Numerics.dll;$(OutLib)/Profile47/MathNet.Numerics.pdb;$(OutLib)/Profile47/MathNet.Numerics.xml;" />
<NumericsProfile136 Include="$(OutLib)/Profile136/MathNet.Numerics.dll;$(OutLib)/Profile136/MathNet.Numerics.pdb;$(OutLib)/Profile136/MathNet.Numerics.xml;" />
<FSharpNet40 Include="$(OutLib)/Net40/MathNet.Numerics.FSharp.dll;$(OutLib)/Net40/MathNet.Numerics.FSharp.pdb;$(OutLib)/Net40/MathNet.Numerics.FSharp.xml" />
@ -38,6 +39,7 @@
<RemoveDir Directories="$(NumericsPack)/lib" />
<Copy SourceFiles="@(NumericsNet40)" DestinationFolder="$(NumericsPack)/lib/net40" />
<Copy SourceFiles="@(NumericsNet35)" DestinationFolder="$(NumericsPack)/lib/net35" />
<Copy SourceFiles="@(NumericsProfile47)" DestinationFolder="$(NumericsPack)/lib/portable-net45+windows8+sl5" />
<Copy SourceFiles="@(NumericsProfile136)" DestinationFolder="$(NumericsPack)/lib/portable-net40+windows8+wp8+sl5" />

2
packages/.gitattributes

@ -0,0 +1,2 @@
repositories.config text
* -text

36
packages/FSharp.Formatting.1.0.15/FSharp.Formatting.1.0.15.nuspec

@ -1,19 +1,19 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>FSharp.Formatting</id>
<version>1.0.15</version>
<title>FSharp.Formatting</title>
<authors>Tomas Petricek, Oleg Pestov, Anh-Dung Phan</authors>
<owners>Tomas Petricek, Oleg Pestov, Anh-Dung Phan</owners>
<licenseUrl>http://github.com/tpetricek/FSharp.Formatting/blob/master/LICENSE.md</licenseUrl>
<projectUrl>http://github.com/tpetricek/FSharp.Formatting</projectUrl>
<iconUrl>https://raw.github.com/tpetricek/FSharp.Formatting/master/docs/misc/logo.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Provides an F# implementation of Markdown parser and F# code formatter that can used to tokenize F# code and obtain information about tokens including tool tips with type information. The package comes with a sample that implements literate programming for F#.</description>
<releaseNotes>Added latex support, tables and better formatting with line numbers</releaseNotes>
<copyright>Copyright 2013</copyright>
<language />
<tags>F# fsharp formatting markdown code fssnip literate programming</tags>
</metadata>
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>FSharp.Formatting</id>
<version>1.0.15</version>
<title>FSharp.Formatting</title>
<authors>Tomas Petricek, Oleg Pestov, Anh-Dung Phan</authors>
<owners>Tomas Petricek, Oleg Pestov, Anh-Dung Phan</owners>
<licenseUrl>http://github.com/tpetricek/FSharp.Formatting/blob/master/LICENSE.md</licenseUrl>
<projectUrl>http://github.com/tpetricek/FSharp.Formatting</projectUrl>
<iconUrl>https://raw.github.com/tpetricek/FSharp.Formatting/master/docs/misc/logo.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Provides an F# implementation of Markdown parser and F# code formatter that can used to tokenize F# code and obtain information about tokens including tool tips with type information. The package comes with a sample that implements literate programming for F#.</description>
<releaseNotes>Added latex support, tables and better formatting with line numbers</releaseNotes>
<copyright>Copyright 2013</copyright>
<language />
<tags>F# fsharp formatting markdown code fssnip literate programming</tags>
</metadata>
</package>

320
packages/FSharp.Formatting.1.0.15/literate/StringParsing.fs

@ -1,160 +1,160 @@
// --------------------------------------------------------------------------------------
// F# Markdown (StringParsing.fs)
// (c) Tomas Petricek, 2012, Available under Apache 2.0 license.
// --------------------------------------------------------------------------------------
module FSharp.Patterns
open System
open FSharp.Collections
// --------------------------------------------------------------------------------------
// Active patterns that simplify parsing of strings and lists of strings (lines)
// --------------------------------------------------------------------------------------
module String =
/// Matches when a string is a whitespace or null
let (|WhiteSpace|_|) s =
if String.IsNullOrWhiteSpace(s) then Some() else None
/// Matches when a string does starts with non-whitespace
let (|Unindented|_|) (s:string) =
if not (String.IsNullOrWhiteSpace(s)) && s.TrimStart() = s then Some() else None
/// Returns a string trimmed from both start and end
let (|TrimBoth|) (text:string) = text.Trim()
/// Returns a string trimmed from the end
let (|TrimEnd|) (text:string) = text.TrimEnd()
/// Returns a string trimmed from the start
let (|TrimStart|) (text:string) = text.TrimStart()
/// Retrusn a string trimmed from the end using characters given as a parameter
let (|TrimEndUsing|) chars (text:string) = text.TrimEnd(Array.ofSeq chars)
/// Returns a string trimmed from the start together with
/// the number of skipped whitespace characters
let (|TrimStartAndCount|) (text:string) =
let trimmed = text.TrimStart()
text.Length - trimmed.Length, trimmed
/// Matches when a string starts with any of the specified sub-strings
let (|StartsWithAny|_|) (starts:seq<string>) (text:string) =
if starts |> Seq.exists (text.StartsWith) then Some() else None
/// Matches when a string starts with the specified sub-string
let (|StartsWith|_|) (start:string) (text:string) =
if text.StartsWith(start) then Some(text.Substring(start.Length)) else None
/// Matches when a string starts with the specified sub-string
/// The matched string is trimmed from all whitespace.
let (|StartsWithTrim|_|) (start:string) (text:string) =
if text.StartsWith(start) then Some(text.Substring(start.Length).Trim()) else None
/// Matches when a string starts with the given value and ends
/// with a given value (and returns the rest of it)
let (|StartsAndEndsWith|_|) (starts, ends) (s:string) =
if s.StartsWith(starts) && s.EndsWith(ends) &&
s.Length >= starts.Length + ends.Length then
Some(s.Substring(starts.Length, s.Length - starts.Length - ends.Length))
else None
/// Matches when a string starts with the given value and ends
/// with a given value (and returns trimmed body)
let (|StartsAndEndsWithTrim|_|) args = function
| StartsAndEndsWith args (TrimBoth res) -> Some res
| _ -> None
/// Matches when a string starts with a non-zero number of complete
/// repetitions of the specified parameter (and returns the number
/// of repetitions, together with the rest of the string)
///
/// let (StartsWithRepeated "/\" (2, " abc")) = "/\/\ abc"
///
let (|StartsWithRepeated|_|) (repeated:string) (text:string) =
let rec loop i =
if i = text.Length then i
elif text.[i] <> repeated.[i % repeated.Length] then i
else loop (i + 1)
let n = loop 0
if n = 0 || n % repeated.Length <> 0 then None
else Some(n/repeated.Length, text.Substring(n, text.Length - n))
/// Matches when a string starts with a sub-string wrapped using the
/// opening and closing sub-string specified in the parameter.
/// For example "[aa]bc" is wrapped in [ and ] pair. Returns the wrapped
/// text together with the rest.
let (|StartsWithWrapped|_|) (starts:string, ends:string) (text:string) =
if text.StartsWith(starts) then
let id = text.IndexOf(ends, starts.Length)
if id >= 0 then
let wrapped = text.Substring(starts.Length, id - starts.Length)
let rest = text.Substring(id + ends.Length, text.Length - id - ends.Length)
Some(wrapped, rest)
else None
else None
/// Matches when a string consists of some number of
/// complete repetitions of a specified sub-string.
let (|EqualsRepeated|_|) repeated = function
| StartsWithRepeated repeated (n, "") -> Some()
| _ -> None
module List =
/// Matches a list if it starts with a sub-list that is delimited
/// using the specified delimiters. Returns a wrapped list and the rest.
let inline (|DelimitedWith|_|) startl endl input =
if List.startsWith startl input then
match List.partitionUntilEquals endl (List.skip startl.Length input) with
| Some(pre, post) -> Some(pre, List.skip endl.Length post)
| None -> None
else None
/// Matches a list if it starts with a sub-list that is delimited
/// using the specified delimiter. Returns a wrapped list and the rest.
let inline (|Delimited|_|) str = (|DelimitedWith|_|) str str
/// Matches a list if it starts with a bracketed list. Nested brackets
/// are skipped (by counting opening and closing brackets) and can be
/// escaped using the '\' symbol.
let (|BracketDelimited|_|) startc endc input =
let rec loop acc count = function
| '\\'::x::xs when x = endc -> loop (x::acc) count xs
| x::xs when x = endc && count = 0 -> Some(List.rev acc, xs)
| x::xs when x = endc -> loop (x::acc) (count - 1) xs
| x::xs when x = startc -> loop (x::acc) (count + 1) xs
| x::xs -> loop (x::acc) count xs
| [] -> None
match input with
| x::xs when x = startc -> loop [] 0 xs
| _ -> None
/// Retruns a list of characters as a string.
let (|AsString|) chars = String(Array.ofList chars)
module Lines =
/// Removes blank lines from the start and the end of a list
let (|TrimBlank|) lines =
lines
|> List.skipWhile String.IsNullOrWhiteSpace |> List.rev
|> List.skipWhile String.IsNullOrWhiteSpace |> List.rev
/// Matches when there are some lines at the beginning that are
/// either empty (or whitespace) or start with the specified string.
/// Returns all such lines from the beginning until a different line.
let (|TakeStartingWithOrBlank|_|) start input =
match List.partitionWhile (fun s ->
String.IsNullOrWhiteSpace s || s.StartsWith(start)) input with
| matching, rest when matching <> [] -> Some(matching, rest)
| _ -> None
/// Removes whitespace lines from the beginning of the list
let (|TrimBlankStart|) = List.skipWhile (String.IsNullOrWhiteSpace)
/// Parameterized pattern that assigns the specified value to the
/// first component of a tuple. Usage:
///
/// match str with
/// | Let 1 (n, "one") | Let 2 (n, "two") -> n
///
let (|Let|) a b = (a, b)
// --------------------------------------------------------------------------------------
// F# Markdown (StringParsing.fs)
// (c) Tomas Petricek, 2012, Available under Apache 2.0 license.
// --------------------------------------------------------------------------------------
module FSharp.Patterns
open System
open FSharp.Collections
// --------------------------------------------------------------------------------------
// Active patterns that simplify parsing of strings and lists of strings (lines)
// --------------------------------------------------------------------------------------
module String =
/// Matches when a string is a whitespace or null
let (|WhiteSpace|_|) s =
if String.IsNullOrWhiteSpace(s) then Some() else None
/// Matches when a string does starts with non-whitespace
let (|Unindented|_|) (s:string) =
if not (String.IsNullOrWhiteSpace(s)) && s.TrimStart() = s then Some() else None
/// Returns a string trimmed from both start and end
let (|TrimBoth|) (text:string) = text.Trim()
/// Returns a string trimmed from the end
let (|TrimEnd|) (text:string) = text.TrimEnd()
/// Returns a string trimmed from the start
let (|TrimStart|) (text:string) = text.TrimStart()
/// Retrusn a string trimmed from the end using characters given as a parameter
let (|TrimEndUsing|) chars (text:string) = text.TrimEnd(Array.ofSeq chars)
/// Returns a string trimmed from the start together with
/// the number of skipped whitespace characters
let (|TrimStartAndCount|) (text:string) =
let trimmed = text.TrimStart()
text.Length - trimmed.Length, trimmed
/// Matches when a string starts with any of the specified sub-strings
let (|StartsWithAny|_|) (starts:seq<string>) (text:string) =
if starts |> Seq.exists (text.StartsWith) then Some() else None
/// Matches when a string starts with the specified sub-string
let (|StartsWith|_|) (start:string) (text:string) =
if text.StartsWith(start) then Some(text.Substring(start.Length)) else None
/// Matches when a string starts with the specified sub-string
/// The matched string is trimmed from all whitespace.
let (|StartsWithTrim|_|) (start:string) (text:string) =
if text.StartsWith(start) then Some(text.Substring(start.Length).Trim()) else None
/// Matches when a string starts with the given value and ends
/// with a given value (and returns the rest of it)
let (|StartsAndEndsWith|_|) (starts, ends) (s:string) =
if s.StartsWith(starts) && s.EndsWith(ends) &&
s.Length >= starts.Length + ends.Length then
Some(s.Substring(starts.Length, s.Length - starts.Length - ends.Length))
else None
/// Matches when a string starts with the given value and ends
/// with a given value (and returns trimmed body)
let (|StartsAndEndsWithTrim|_|) args = function
| StartsAndEndsWith args (TrimBoth res) -> Some res
| _ -> None
/// Matches when a string starts with a non-zero number of complete
/// repetitions of the specified parameter (and returns the number
/// of repetitions, together with the rest of the string)
///
/// let (StartsWithRepeated "/\" (2, " abc")) = "/\/\ abc"
///
let (|StartsWithRepeated|_|) (repeated:string) (text:string) =
let rec loop i =
if i = text.Length then i
elif text.[i] <> repeated.[i % repeated.Length] then i
else loop (i + 1)
let n = loop 0
if n = 0 || n % repeated.Length <> 0 then None
else Some(n/repeated.Length, text.Substring(n, text.Length - n))
/// Matches when a string starts with a sub-string wrapped using the
/// opening and closing sub-string specified in the parameter.
/// For example "[aa]bc" is wrapped in [ and ] pair. Returns the wrapped
/// text together with the rest.
let (|StartsWithWrapped|_|) (starts:string, ends:string) (text:string) =
if text.StartsWith(starts) then
let id = text.IndexOf(ends, starts.Length)
if id >= 0 then
let wrapped = text.Substring(starts.Length, id - starts.Length)
let rest = text.Substring(id + ends.Length, text.Length - id - ends.Length)
Some(wrapped, rest)
else None
else None
/// Matches when a string consists of some number of
/// complete repetitions of a specified sub-string.
let (|EqualsRepeated|_|) repeated = function
| StartsWithRepeated repeated (n, "") -> Some()
| _ -> None
module List =
/// Matches a list if it starts with a sub-list that is delimited
/// using the specified delimiters. Returns a wrapped list and the rest.
let inline (|DelimitedWith|_|) startl endl input =
if List.startsWith startl input then
match List.partitionUntilEquals endl (List.skip startl.Length input) with
| Some(pre, post) -> Some(pre, List.skip endl.Length post)
| None -> None
else None
/// Matches a list if it starts with a sub-list that is delimited
/// using the specified delimiter. Returns a wrapped list and the rest.
let inline (|Delimited|_|) str = (|DelimitedWith|_|) str str
/// Matches a list if it starts with a bracketed list. Nested brackets
/// are skipped (by counting opening and closing brackets) and can be
/// escaped using the '\' symbol.
let (|BracketDelimited|_|) startc endc input =
let rec loop acc count = function
| '\\'::x::xs when x = endc -> loop (x::acc) count xs
| x::xs when x = endc && count = 0 -> Some(List.rev acc, xs)
| x::xs when x = endc -> loop (x::acc) (count - 1) xs
| x::xs when x = startc -> loop (x::acc) (count + 1) xs
| x::xs -> loop (x::acc) count xs
| [] -> None
match input with
| x::xs when x = startc -> loop [] 0 xs
| _ -> None
/// Retruns a list of characters as a string.
let (|AsString|) chars = String(Array.ofList chars)
module Lines =
/// Removes blank lines from the start and the end of a list
let (|TrimBlank|) lines =
lines
|> List.skipWhile String.IsNullOrWhiteSpace |> List.rev
|> List.skipWhile String.IsNullOrWhiteSpace |> List.rev
/// Matches when there are some lines at the beginning that are
/// either empty (or whitespace) or start with the specified string.
/// Returns all such lines from the beginning until a different line.
let (|TakeStartingWithOrBlank|_|) start input =
match List.partitionWhile (fun s ->
String.IsNullOrWhiteSpace s || s.StartsWith(start)) input with
| matching, rest when matching <> [] -> Some(matching, rest)
| _ -> None
/// Removes whitespace lines from the beginning of the list
let (|TrimBlankStart|) = List.skipWhile (String.IsNullOrWhiteSpace)
/// Parameterized pattern that assigns the specified value to the
/// first component of a tuple. Usage:
///
/// match str with
/// | Let 1 (n, "one") | Let 2 (n, "two") -> n
///
let (|Let|) a b = (a, b)

92
packages/FSharp.Formatting.1.0.15/literate/content/tips.js

@ -1,47 +1,47 @@
var currentTip = null;
var currentTipElement = null;
function hideTip(evt, name, unique)
{
var el = document.getElementById(name);
el.style.display = "none";
currentTip = null;
}
function findPos(obj)
{
var curleft = 0;
var curtop = obj.offsetHeight;
while (obj)
{
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
obj = obj.offsetParent;
};
return [curleft, curtop];
}
function hideUsingEsc(e)
{
if (!e) { e = event; }
hideTip(e, currentTipElement, currentTip);
}
function showTip(evt, name, unique, owner)
{
document.onkeydown = hideUsingEsc;
if (currentTip == unique) return;
currentTip = unique;
currentTipElement = name;
var pos = findPos(owner ? owner : (evt.srcElement ? evt.srcElement : evt.target));
var posx = pos[0];
var posy = pos[1];
var el = document.getElementById(name);
var parent = (document.documentElement == null) ? document.body : document.documentElement;
el.style.position = "absolute";
el.style.left = posx + "px";
el.style.top = posy + "px";
el.style.display = "block";
var currentTip = null;
var currentTipElement = null;
function hideTip(evt, name, unique)
{
var el = document.getElementById(name);
el.style.display = "none";
currentTip = null;
}
function findPos(obj)
{
var curleft = 0;
var curtop = obj.offsetHeight;
while (obj)
{
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
obj = obj.offsetParent;
};
return [curleft, curtop];
}
function hideUsingEsc(e)
{
if (!e) { e = event; }
hideTip(e, currentTipElement, currentTip);
}
function showTip(evt, name, unique, owner)
{
document.onkeydown = hideUsingEsc;
if (currentTip == unique) return;
currentTip = unique;
currentTipElement = name;
var pos = findPos(owner ? owner : (evt.srcElement ? evt.srcElement : evt.target));
var posx = pos[0];
var posy = pos[1];
var el = document.getElementById(name);
var parent = (document.documentElement == null) ? document.body : document.documentElement;
el.style.position = "absolute";
el.style.left = posx + "px";
el.style.top = posy + "px";
el.style.display = "block";
}

68
packages/FSharp.Formatting.1.0.15/literate/templates/template-file.html

@ -1,35 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!--
The {page-title} parameters will be replaced with the
document title extracted from the <h1> element or
file name, if there is no <h1> heading
-->
<title>{page-title}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="http://code.jquery.com/jquery-1.8.0.js"></script>
<script src="http://code.jquery.com/ui/1.8.23/jquery-ui.js"></script>
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js"></script>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="content/style.css" />
<script src="content/tips.js" type="text/javascript"></script>
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="row" style="margin-top:30px">
<div class="span1"></div>
<div class="span10" id="main">
{document}
{tooltips}
</div>
<div class="span1"></div>
</div>
</div>
</body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!--
The {page-title} parameters will be replaced with the
document title extracted from the <h1> element or
file name, if there is no <h1> heading
-->
<title>{page-title}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="http://code.jquery.com/jquery-1.8.0.js"></script>
<script src="http://code.jquery.com/ui/1.8.23/jquery-ui.js"></script>
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js"></script>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="content/style.css" />
<script src="content/tips.js" type="text/javascript"></script>
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="row" style="margin-top:30px">
<div class="span1"></div>
<div class="span10" id="main">
{document}
{tooltips}
</div>
<div class="span1"></div>
</div>
</div>
</body>
</html>

122
packages/FSharp.Formatting.1.0.15/literate/templates/template-project.html

@ -1,62 +1,62 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!--
The {page-title} parameters will be replaced with the
document title extracted from the <h1> element or
file name, if there is no <h1> heading
-->
<title>{page-title}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{page-description}">
<meta name="author" content="{page-author}">
<script src="http://code.jquery.com/jquery-1.8.0.js"></script>
<script src="http://code.jquery.com/ui/1.8.23/jquery-ui.js"></script>
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js"></script>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="content/style.css" />
<script src="content/tips.js" type="text/javascript"></script>
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="masthead">
<ul class="nav nav-pills pull-right">
<li><a href="http://fsharp.org">fsharp.org</a></li>
<li><a href="{github-link}">github page</a></li>
</ul>
<h3 class="muted">{project-name}</h3>
</div>
<hr />
<div class="row">
<div class="span9" id="main">
{document}
{tooltips}
</div>
<div class="span3">
<ul class="nav nav-list" id="menu">
<li class="nav-header">{project-name}</li>
<li><a href="../index.html">Home page</a></li>
<!--
Here you can add links to other pages of the documentation
The 'divider' element creates a separator and additional
'nav-header' can be used to add sub-headings in the menu:
* <li class="divider"></li>
* <li><a href="...">...</a></li>
* <li class="nav-header">Sub-heading</li>
-->
</ul>
</div>
</div>
</div>
<a href="{github-link}"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" alt="Fork me on GitHub"></a>
</body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!--
The {page-title} parameters will be replaced with the
document title extracted from the <h1> element or
file name, if there is no <h1> heading
-->
<title>{page-title}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{page-description}">
<meta name="author" content="{page-author}">
<script src="http://code.jquery.com/jquery-1.8.0.js"></script>
<script src="http://code.jquery.com/ui/1.8.23/jquery-ui.js"></script>
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js"></script>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="content/style.css" />
<script src="content/tips.js" type="text/javascript"></script>
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="masthead">
<ul class="nav nav-pills pull-right">
<li><a href="http://fsharp.org">fsharp.org</a></li>
<li><a href="{github-link}">github page</a></li>
</ul>
<h3 class="muted">{project-name}</h3>
</div>
<hr />
<div class="row">
<div class="span9" id="main">
{document}
{tooltips}
</div>
<div class="span3">
<ul class="nav nav-list" id="menu">
<li class="nav-header">{project-name}</li>
<li><a href="../index.html">Home page</a></li>
<!--
Here you can add links to other pages of the documentation
The 'divider' element creates a separator and additional
'nav-header' can be used to add sub-headings in the menu:
* <li class="divider"></li>
* <li><a href="...">...</a></li>
* <li class="nav-header">Sub-heading</li>
-->
</ul>
</div>
</div>
</div>
<a href="{github-link}"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" alt="Fork me on GitHub"></a>
</body>
</html>

42
packages/FsUnit.1.2.1.0/FsUnit.1.2.1.0.nuspec

@ -1,22 +1,22 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>FsUnit</id>
<version>1.2.1.0</version>
<title>FsUnit</title>
<authors>Ray Vernagus and Daniel Mohl</authors>
<owners>Ray Vernagus and Daniel Mohl</owners>
<licenseUrl>http://fsunit.codeplex.com/license</licenseUrl>
<projectUrl>http://fsunit.codeplex.com/</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>FsUnit is a set of extensions that add special testing syntax to NUnit.</description>
<summary>The goals of FsUnit are to make unit-testing feel more functional while leverage existing testing frameworks.</summary>
<releaseNotes />
<copyright />
<language>en-US</language>
<tags>F# fsharp NUnit FsUnit</tags>
<dependencies>
<dependency id="NUnit" version="2.6.2" />
</dependencies>
</metadata>
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>FsUnit</id>
<version>1.2.1.0</version>
<title>FsUnit</title>
<authors>Ray Vernagus and Daniel Mohl</authors>
<owners>Ray Vernagus and Daniel Mohl</owners>
<licenseUrl>http://fsunit.codeplex.com/license</licenseUrl>
<projectUrl>http://fsunit.codeplex.com/</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>FsUnit is a set of extensions that add special testing syntax to NUnit.</description>
<summary>The goals of FsUnit are to make unit-testing feel more functional while leverage existing testing frameworks.</summary>
<releaseNotes />
<copyright />
<language>en-US</language>
<tags>F# fsharp NUnit FsUnit</tags>
<dependencies>
<dependency id="NUnit" version="2.6.2" />
</dependencies>
</metadata>
</package>

52
packages/NUnit.2.6.3/NUnit.2.6.3.nuspec

@ -1,27 +1,27 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>NUnit</id>
<version>2.6.3</version>
<title>NUnit</title>
<authors>Charlie Poole</authors>
<owners>Charlie Poole</owners>
<licenseUrl>http://nunit.org/nuget/license.html</licenseUrl>
<projectUrl>http://nunit.org/</projectUrl>
<iconUrl>http://nunit.org/nuget/nunit_32x32.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>NUnit features a fluent assert syntax, parameterized, generic and theory tests and is user-extensible. A number of runners, both from the NUnit project and by third parties, are able to execute NUnit tests.
Version 2.6 is the seventh major release of this well-known and well-tested programming tool.
This package includes only the framework assembly. You will need to install the NUnit.Runners package unless you are using a third-party runner.</description>
<summary>NUnit is a unit-testing framework for all .Net languages with a strong TDD focus.</summary>
<releaseNotes>Version 2.6 is the seventh major release of NUnit.
Unlike earlier versions, this package includes only the framework assembly. You will need to install the NUnit.Runners package unless you are using a third-party runner.
The nunit.mocks assembly is now provided by the NUnit.Mocks package. The pnunit.framework assembly is provided by the pNUnit package.</releaseNotes>
<language>en-US</language>
<tags>nunit test testing tdd framework fluent assert theory plugin addin</tags>
</metadata>
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>NUnit</id>
<version>2.6.3</version>
<title>NUnit</title>
<authors>Charlie Poole</authors>
<owners>Charlie Poole</owners>
<licenseUrl>http://nunit.org/nuget/license.html</licenseUrl>
<projectUrl>http://nunit.org/</projectUrl>
<iconUrl>http://nunit.org/nuget/nunit_32x32.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>NUnit features a fluent assert syntax, parameterized, generic and theory tests and is user-extensible. A number of runners, both from the NUnit project and by third parties, are able to execute NUnit tests.
Version 2.6 is the seventh major release of this well-known and well-tested programming tool.
This package includes only the framework assembly. You will need to install the NUnit.Runners package unless you are using a third-party runner.</description>
<summary>NUnit is a unit-testing framework for all .Net languages with a strong TDD focus.</summary>
<releaseNotes>Version 2.6 is the seventh major release of NUnit.
Unlike earlier versions, this package includes only the framework assembly. You will need to install the NUnit.Runners package unless you are using a third-party runner.
The nunit.mocks assembly is now provided by the NUnit.Mocks package. The pnunit.framework assembly is provided by the pNUnit package.</releaseNotes>
<language>en-US</language>
<tags>nunit test testing tdd framework fluent assert theory plugin addin</tags>
</metadata>
</package>

BIN
packages/TaskParallelLibrary.1.0.2856.0/TaskParallelLibrary.1.0.2856.0.nupkg

Binary file not shown.

24
packages/TaskParallelLibrary.1.0.2856.0/TaskParallelLibrary.1.0.2856.0.nuspec

@ -0,0 +1,24 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>TaskParallelLibrary</id>
<version>1.0.2856.0</version>
<title>Task Parallel Library for .NET 3.5</title>
<authors>Microsoft Corporation</authors>
<owners>Microsoft Corporation</owners>
<licenseUrl>http://go.microsoft.com/fwlink/?LinkID=186234</licenseUrl>
<projectUrl>http://msdn.microsoft.com/en-us/library/dd460717.aspx</projectUrl>
<iconUrl>http://i.msdn.microsoft.com/ee402630.NET_lg.png</iconUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>The package includes:
* Task&lt;T&gt; for executing asynchronous operations.
* Concurrent Collections such as ConcurrentStack, ConcurentQueue ad ConcurrentDictionary.
* PLINQ for writing parallel queries.
* additional Threading operations such as Barrier,SpinLock and SpinWait.</description>
<summary>A complete and official Microsoft backport of the Task Parallel Library (TPL) for .NET 3.5.</summary>
<releaseNotes>This backport was shipped with the Reactive Extensions (Rx) library up until v1.0.2856.0. It can be downloaded from http://www.microsoft.com/download/en/details.aspx?id=24940 .</releaseNotes>
<copyright />
<language />
<tags>tpl plinq pfx task parallel extensions .net35 backport</tags>
</metadata>
</package>

BIN
packages/TaskParallelLibrary.1.0.2856.0/lib/Net35/System.Threading.chm

Binary file not shown.

BIN
packages/TaskParallelLibrary.1.0.2856.0/lib/Net35/System.Threading.dll

Binary file not shown.

11
packages/TaskParallelLibrary.1.0.2856.0/lib/Net35/redist.txt

@ -0,0 +1,11 @@
The files below can be distributed as described in the MICROSOFT REACTIVE EXTENSTIONS FOR JAVASCRIPT AND .NET LIBRARIES License.
System.Observable.dll
System.CoreEx.dll
System.Reactive.dll
System.Interactive.dll
System.Threading.dll
System.Linq.Async.dll
System.Reactive.Testing.dll
System.Reactive.ClientProfile.dll
System.Reactive.ExtendedProfile.dll

11
packages/repositories.config

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<repositories>
<repository path="..\src\FSharpExamples\packages.config" />
<repository path="..\src\FSharpUnitTests\packages.config" />
<repository path="..\src\UnitTests\packages.config" />
<?xml version="1.0" encoding="utf-8"?>
<repositories>
<repository path="..\src\FSharpExamples\packages.config" />
<repository path="..\src\FSharpUnitTests\packages.config" />
<repository path="..\src\Numerics\packages.config" />
<repository path="..\src\UnitTests\packages.config" />
</repositories>

145
src/Examples/ContinuousDistributions/TriangularDistribution.cs

@ -0,0 +1,145 @@
// <copyright file="TriangularDistribution.cs" 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-2010 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>
using System;
using MathNet.Numerics.Distributions;
namespace Examples.ContinuousDistributionsExamples
{
/// <summary>
/// ContinuousUniform distribution example
/// </summary>
public class TriangularDistribution : IExample
{
/// <summary>
/// Gets the name of this example
/// </summary>
/// <seealso cref="http://reference.wolfram.com/mathematica/ref/TriangularDistribution.html"/>
public string Name
{
get
{
return "Triangular distribution";
}
}
/// <summary>
/// Gets the description of this example
/// </summary>
public string Description
{
get
{
return "Triangular distribution properties and samples generating examples";
}
}
/// <summary>
/// Run example
/// </summary>
/// <a href="https://en.wikipedia.org/wiki/Triangular_distribution">Triangular distribution</a>
public void Run()
{
// 1. Initialize
var triangular = new Triangular(0, 1, 0.3);
Console.WriteLine(@"1. Initialize the new instance of the Triangular distribution class with parameters Lower = {0}, Upper = {1}, Mode = {2}", triangular.LowerBound, triangular.UpperBound, triangular.Mode);
Console.WriteLine();
// 2. Distributuion properties:
Console.WriteLine(@"2. {0} distributuion properties:", triangular);
// Cumulative distribution function
Console.WriteLine(@"{0} - Сumulative distribution at location '0.3'", triangular.CumulativeDistribution(0.3).ToString(" #0.00000;-#0.00000"));
// Probability density
Console.WriteLine(@"{0} - Probability density at location '0.3'", triangular.Density(0.3).ToString(" #0.00000;-#0.00000"));
// Log probability density
Console.WriteLine(@"{0} - Log probability density at location '0.3'", triangular.DensityLn(0.3).ToString(" #0.00000;-#0.00000"));
// Entropy
Console.WriteLine(@"{0} - Entropy", triangular.Entropy.ToString(" #0.00000;-#0.00000"));
// Largest element in the domain
Console.WriteLine(@"{0} - Largest element in the domain", triangular.Maximum.ToString(" #0.00000;-#0.00000"));
// Smallest element in the domain
Console.WriteLine(@"{0} - Smallest element in the domain", triangular.Minimum.ToString(" #0.00000;-#0.00000"));
// Mean
Console.WriteLine(@"{0} - Mean", triangular.Mean.ToString(" #0.00000;-#0.00000"));
// Median
Console.WriteLine(@"{0} - Median", triangular.Median.ToString(" #0.00000;-#0.00000"));
// Mode
Console.WriteLine(@"{0} - Mode", triangular.Mode.ToString(" #0.00000;-#0.00000"));
// Variance
Console.WriteLine(@"{0} - Variance", triangular.Variance.ToString(" #0.00000;-#0.00000"));
// Standard deviation
Console.WriteLine(@"{0} - Standard deviation", triangular.StdDev.ToString(" #0.00000;-#0.00000"));
// Skewness
Console.WriteLine(@"{0} - Skewness", triangular.Skewness.ToString(" #0.00000;-#0.00000"));
Console.WriteLine();
// 10 samples
Console.WriteLine(@"3. Generate 10 samples of the Triangular distribution");
for (var i = 0; i < 10; i++)
{
Console.Write(triangular.Sample().ToString("N05") + @" ");
}
Console.WriteLine();
Console.WriteLine();
// 10000 samples with starting parameters
Console.WriteLine(@"4. Generate 100000 samples of the Triangular({0}, {1}, {2}) distribution and display histogram", triangular.LowerBound, triangular.UpperBound, triangular.Mode);
var data = new double[100000];
for (var i = 0; i < data.Length; i++)
{
data[i] = triangular.Sample();
}
ConsoleHelper.DisplayHistogram(data);
Console.WriteLine();
// 10000 with different parameters
triangular.UpperBound = 10;
triangular.Mode = 8;
triangular.LowerBound = 2;
Console.WriteLine(@"4. Generate 100000 samples of the Triangular({0}, {1}, {2}) distribution and display histogram", triangular.LowerBound, triangular.UpperBound, triangular.Mode);
for (var i = 0; i < data.Length; i++)
{
data[i] = triangular.Sample();
}
ConsoleHelper.DisplayHistogram(data);
}
}
}

1
src/Examples/Examples.csproj

@ -88,6 +88,7 @@
<Compile Include="ContinuousDistributions\CauchyDistribution.cs" />
<Compile Include="ContinuousDistributions\ChiDistribution.cs" />
<Compile Include="ContinuousDistributions\ChiSquareDistribution.cs" />
<Compile Include="ContinuousDistributions\TriangularDistribution.cs" />
<Compile Include="ContinuousDistributions\ContinuousUniformDistribution.cs" />
<Compile Include="ContinuousDistributions\WeibullDistribution.cs" />
<Compile Include="ContinuousDistributions\StudentTDistribution.cs" />

8
src/Examples/Interpolation/AkimaSpline.cs

@ -25,9 +25,9 @@
// </copyright>
using System;
using MathNet.Numerics;
using MathNet.Numerics.Interpolation;
using MathNet.Numerics.Random;
using MathNet.Numerics.Signals;
namespace Examples.InterpolationExamples
{
@ -67,12 +67,12 @@ namespace Examples.InterpolationExamples
{
// 1. Generate 10 samples of the function x*x-2*x on interval [0, 10]
Console.WriteLine(@"1. Generate 10 samples of the function x*x-2*x on interval [0, 10]");
double[] points;
var values = SignalGenerator.EquidistantInterval(TargetFunction, 0, 10, 10, out points);
double[] points = Generate.LinearSpaced(10, 0, 10);
var values = Generate.Map(points, TargetFunction);
Console.WriteLine();
// 2. Create akima spline interpolation
var method = new AkimaSplineInterpolation(points, values);
var method = CubicSpline.InterpolateAkima(points, values);
Console.WriteLine(@"2. Create akima spline interpolation based on arbitrary points");
Console.WriteLine();

7
src/Examples/Interpolation/LinearBetweenPoints.cs

@ -27,7 +27,6 @@
using System;
using MathNet.Numerics;
using MathNet.Numerics.Random;
using MathNet.Numerics.Signals;
namespace Examples.InterpolationExamples
{
@ -67,12 +66,12 @@ namespace Examples.InterpolationExamples
{
// 1. Generate 20 samples of the function x*x-2*x on interval [0, 10]
Console.WriteLine(@"1. Generate 20 samples of the function x*x-2*x on interval [0, 10]");
double[] points;
var values = SignalGenerator.EquidistantInterval(TargetFunction, 0, 10, 20, out points);
double[] points = Generate.LinearSpaced(20, 0, 10);
var values = Generate.Map(points, TargetFunction);
Console.WriteLine();
// 2. Create a linear spline interpolation based on arbitrary points
var method = Interpolate.LinearBetweenPoints(points, values);
var method = Interpolate.LinearSpline(points, values);
Console.WriteLine(@"2. Create a linear spline interpolation based on arbitrary points");
Console.WriteLine();

5
src/Examples/Interpolation/RationalWithPoles.cs

@ -27,7 +27,6 @@
using System;
using MathNet.Numerics;
using MathNet.Numerics.Random;
using MathNet.Numerics.Signals;
namespace Examples.InterpolationExamples
{
@ -66,8 +65,8 @@ namespace Examples.InterpolationExamples
{
// 1. Generate 20 samples of the function f(x) = x on interval [-5, 5]
Console.WriteLine(@"1. Generate 20 samples of the function f(x) = x on interval [-5, 5]");
double[] points;
var values = SignalGenerator.EquidistantInterval(TargetFunction, -5, 5, 20, out points);
double[] points = Generate.LinearSpaced(20, -5, 5);
var values = Generate.Map(points, TargetFunction);
Console.WriteLine();
// 2. Create a burlish stoer rational interpolation based on arbitrary points

5
src/Examples/Interpolation/RationalWithoutPoles.cs

@ -27,7 +27,6 @@
using System;
using MathNet.Numerics;
using MathNet.Numerics.Random;
using MathNet.Numerics.Signals;
namespace Examples.InterpolationExamples
{
@ -67,8 +66,8 @@ namespace Examples.InterpolationExamples
{
// 1. Generate 10 samples of the function 1/(1+x*x) on interval [-5, 5]
Console.WriteLine(@"1. Generate 10 samples of the function 1/(1+x*x) on interval [-5, 5]");
double[] points;
var values = SignalGenerator.EquidistantInterval(TargetFunction, -5, 5, 10, out points);
double[] points = Generate.LinearSpaced(10, -5, 5);
var values = Generate.Map(points, TargetFunction);
Console.WriteLine();
// 2. Create a floater hormann rational pole-free interpolation based on arbitrary points

10
src/Examples/LinearAlgebra/VectorInitialization.cs

@ -26,7 +26,7 @@
using System;
using System.Globalization;
using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra;
namespace Examples.LinearAlgebraExamples
{
@ -63,16 +63,16 @@ namespace Examples.LinearAlgebraExamples
public void Run()
{
// 1. Initialize a new instance of the empty vector with a given size
var vector1 = new DenseVector(5);
var vector1 = Vector<double>.Build.Dense(5);
// 2. Initialize a new instance of the vector with a given size and each element set to the given value
var vector2 = DenseVector.Create(5, i => 3.0);
var vector2 = Vector<double>.Build.Dense(5, i => i + 3.0);
// 3. Initialize a new instance of the vector from an array.
var vector3 = new DenseVector(new[] { 1.0, 2.0, 3.0, 4.0, 5.0 });
var vector3 = Vector<double>.Build.Dense(new[] { 1.0, 2.0, 3.0, 4.0, 5.0 });
// 4. Initialize a new instance of the vector by copying the values from another.
var vector4 = DenseVector.OfVector(vector3);
var vector4 = Vector<double>.Build.DenseOfVector(vector3);
// Format vector output to console
var formatProvider = (CultureInfo)CultureInfo.InvariantCulture.Clone();

18
src/Examples/NumberTheory.cs

@ -25,7 +25,7 @@
// </copyright>
using System;
using MathNet.Numerics.NumberTheory;
using MathNet.Numerics;
namespace Examples
{
@ -63,17 +63,17 @@ namespace Examples
{
// 1. Find out whether the provided number is an even number
Console.WriteLine(@"1. Find out whether the provided number is an even number");
Console.WriteLine(@"{0} is even = {1}. {2} is even = {3}", 1, IntegerTheory.IsEven(1), 2, 2.IsEven());
Console.WriteLine(@"{0} is even = {1}. {2} is even = {3}", 1, Euclid.IsEven(1), 2, 2.IsEven());
Console.WriteLine();
// 2. Find out whether the provided number is an odd number
Console.WriteLine(@"2. Find out whether the provided number is an odd number");
Console.WriteLine(@"{0} is odd = {1}. {2} is odd = {3}", 1, 1.IsOdd(), 2, IntegerTheory.IsOdd(2));
Console.WriteLine(@"{0} is odd = {1}. {2} is odd = {3}", 1, 1.IsOdd(), 2, Euclid.IsOdd(2));
Console.WriteLine();
// 3. Find out whether the provided number is a perfect power of two
Console.WriteLine(@"2. Find out whether the provided number is a perfect power of two");
Console.WriteLine(@"{0} is power of two = {1}. {2} is power of two = {3}", 5, 5.IsPowerOfTwo(), 16, IntegerTheory.IsPowerOfTwo(16));
Console.WriteLine(@"{0} is power of two = {1}. {2} is power of two = {3}", 5, 5.IsPowerOfTwo(), 16, Euclid.IsPowerOfTwo(16));
Console.WriteLine();
// 4. Find the closest perfect power of two that is larger or equal to 97
@ -88,29 +88,29 @@ namespace Examples
// 6. Find out whether the number is a perfect square
Console.WriteLine(@"6. Find out whether the number is a perfect square");
Console.WriteLine(@"{0} is perfect square = {1}. {2} is perfect square = {3}", 37, 37.IsPerfectSquare(), 81, IntegerTheory.IsPerfectSquare(81));
Console.WriteLine(@"{0} is perfect square = {1}. {2} is perfect square = {3}", 37, 37.IsPerfectSquare(), 81, Euclid.IsPerfectSquare(81));
Console.WriteLine();
// 7. Compute the greatest common divisor of 32 and 36
Console.WriteLine(@"7. Returns the greatest common divisor of 32 and 36");
Console.WriteLine(IntegerTheory.GreatestCommonDivisor(32, 36));
Console.WriteLine(Euclid.GreatestCommonDivisor(32, 36));
Console.WriteLine();
// 8. Compute the greatest common divisor of 492, -984, 123, 246
Console.WriteLine(@"8. Returns the greatest common divisor of 492, -984, 123, 246");
Console.WriteLine(IntegerTheory.GreatestCommonDivisor(492, -984, 123, 246));
Console.WriteLine(Euclid.GreatestCommonDivisor(492, -984, 123, 246));
Console.WriteLine();
// 9. Compute the extended greatest common divisor "z", such that 45*x + 18*y = z
Console.WriteLine(@"9. Compute the extended greatest common divisor Z, such that 45*x + 18*y = Z");
long x, y;
var z = IntegerTheory.ExtendedGreatestCommonDivisor(45, 18, out x, out y);
var z = Euclid.ExtendedGreatestCommonDivisor(45, 18, out x, out y);
Console.WriteLine(@"z = {0}, x = {1}, y = {2}. 45*{1} + 18*{2} = {0}", z, x, y);
Console.WriteLine();
// 10. Compute the least common multiple of 16 and 12
Console.WriteLine(@"10. Compute the least common multiple of 16 and 12");
Console.WriteLine(IntegerTheory.LeastCommonMultiple(16, 12));
Console.WriteLine(Euclid.LeastCommonMultiple(16, 12));
Console.WriteLine();
}
}

6
src/Examples/RandomNumberGeneration.cs

@ -89,7 +89,7 @@ namespace Examples
// 1. Multiplicative congruential generator using a modulus of 2^31-1 and a multiplier of 1132489760
var mcg31M1 = new Mcg31m1(1);
Console.WriteLine(@"1. Generate 10 random double values using Multiplicative congruential generator with a modulus of 2^31-1 and a multiplier of 1132489760");
var randomValues = mcg31M1.NextDouble(10);
var randomValues = mcg31M1.NextDoubles(10);
for (var i = 0; i < randomValues.Length; i++)
{
Console.Write(randomValues[i].ToString("N") + @" ");
@ -145,11 +145,11 @@ namespace Examples
Console.WriteLine();
// 6. A random number generator based on the "System.Security.Cryptography.RandomNumberGenerator" class in the .NET library
var systemCryptoRandomNumberGenerator = new SystemCryptoRandomNumberGenerator();
var systemCrypto = new CryptoRandomSource();
Console.WriteLine(@"6. Generate 10 random decimal values using RNG based on the 'System.Security.Cryptography.RandomNumberGenerator'");
for (var i = 0; i < 10; i++)
{
Console.Write(systemCryptoRandomNumberGenerator.NextDecimal().ToString("N") + @" ");
Console.Write(systemCrypto.NextDecimal().ToString("N") + @" ");
}
Console.WriteLine();

8
src/Examples/Signals/Chebyshev.cs

@ -25,7 +25,7 @@
// </copyright>
using System;
using MathNet.Numerics.Signals;
using MathNet.Numerics;
namespace Examples.SignalsExamples
{
@ -62,7 +62,8 @@ namespace Examples.SignalsExamples
public void Run()
{
// 1. Get 20 samples of f(x) = (x * x) / 2 at the roots of the Chebyshev polynomial of the first kind within interval [0, 10]
var result = SignalGenerator.ChebyshevNodesFirstKind(Function, 0, 10, 20);
var roots = FindRoots.ChebychevPolynomialFirstKind(20, 0, 10);
var result = Generate.Map(roots, Function);
Console.WriteLine(@"1. Get 20 samples of f(x) = (x * x) / 2 at the roots of the Chebyshev polynomial of the first kind within interval [0, 10]");
for (var i = 0; i < result.Length; i++)
{
@ -73,7 +74,8 @@ namespace Examples.SignalsExamples
Console.WriteLine();
// 2. Get 20 samples of f(x) = (x * x) / 2 at the roots of the Chebyshev polynomial of the second kind within interval [0, 10]
result = SignalGenerator.ChebyshevNodesSecondKind(Function, 0, 10, 20);
roots = FindRoots.ChebychevPolynomialSecondKind(20, 0, 10);
result = Generate.Map(roots, Function);
Console.WriteLine(@"2. Get 20 samples of f(x) = (x * x) / 2 at the roots of the Chebyshev polynomial of the second kind within interval [0, 10]");
for (var i = 0; i < result.Length; i++)
{

21
src/Examples/Signals/Equidistant.cs

@ -25,7 +25,7 @@
// </copyright>
using System;
using MathNet.Numerics.Signals;
using MathNet.Numerics;
namespace Examples.SignalsExamples
{
@ -62,7 +62,7 @@ namespace Examples.SignalsExamples
public void Run()
{
// 1. Get 11 samples of f(x) = (x * x) / 2 equidistant within interval [-5, 5]
var result = SignalGenerator.EquidistantInterval(Function, -5, 5, 11);
var result = Generate.LinearSpacedMap(11, -5, 5, Function);
Console.WriteLine(@"1. Get 11 samples of f(x) = (x * x) / 2 equidistant within interval [-5, 5]");
for (var i = 0; i < result.Length; i++)
{
@ -73,8 +73,8 @@ namespace Examples.SignalsExamples
Console.WriteLine();
// 2. Get 10 samples of f(x) = (x * x) / 2 equidistant starting at x=1 with step = 0.5 and retrieve sample points
double[] samplePoints;
result = SignalGenerator.EquidistantStartingAt(Function, 1, 0.5, 10, out samplePoints);
double[] samplePoints = Generate.LinearSpaced(10, 1.0, 5.5);
result = Generate.Map(samplePoints, Function);
Console.WriteLine(@"2. Get 10 samples of f(x) = (x * x) / 2 equidistant starting at x=1 with step = 0.5 and retrieve sample points");
Console.Write(@"Points: ");
for (var i = 0; i < samplePoints.Length; i++)
@ -93,24 +93,13 @@ namespace Examples.SignalsExamples
Console.WriteLine();
// 3. Get 10 samples of f(x) = (x * x) / 2 equidistant within period = 10 and period offset = 5
result = SignalGenerator.EquidistantPeriodic(Function, 10, 5, 10);
result = Generate.PeriodicMap(10, Function, 10, 1.0, 10, 5);
Console.WriteLine(@"3. Get 10 samples of f(x) = (x * x) / 2 equidistant within period = 10 and period offset = 5");
for (var i = 0; i < result.Length; i++)
{
Console.Write(result[i].ToString("N") + @" ");
}
Console.WriteLine();
Console.WriteLine();
// 4. Sample f(x) = (x * x) / 2 equidistant to an integer-domain function starting at x = 0 and step = 2
var equidistant = SignalGenerator.EquidistantToFunction(Function, 0, 2);
Console.WriteLine(@" 4. Sample f(x) = (x * x) / 2 equidistant to an integer-domain function starting at x = 0 and step = 2");
for (var i = 0; i < 10; i++)
{
Console.Write(equidistant(i).ToString("N") + @" ");
}
Console.WriteLine();
}

10
src/Examples/Signals/Random.cs

@ -25,8 +25,8 @@
// </copyright>
using System;
using MathNet.Numerics;
using MathNet.Numerics.Distributions;
using MathNet.Numerics.Signals;
namespace Examples.SignalsExamples
{
@ -64,7 +64,7 @@ namespace Examples.SignalsExamples
{
// 1. Get 10 random samples of f(x) = (x * x) / 2 using continuous uniform distribution on [-10, 10]
var uniform = new ContinuousUniform(-10, 10);
var result = SignalGenerator.Random(Function, uniform, 10);
var result = Generate.RandomMap(10, uniform, Function);
Console.WriteLine(@" 1. Get 10 random samples of f(x) = (x * x) / 2 using continuous uniform distribution on [-10, 10]");
for (var i = 0; i < result.Length; i++)
{
@ -76,8 +76,8 @@ namespace Examples.SignalsExamples
// 2. Get 10 random samples of f(x) = (x * x) / 2 using Exponential(1) distribution and retrieve sample points
var exponential = new Exponential(1);
double[] samplePoints;
result = SignalGenerator.Random(Function, exponential, 10, out samplePoints);
double[] samplePoints = Generate.Random(10, exponential);
result = Generate.Map(samplePoints, Function);
Console.WriteLine(@"2. Get 10 random samples of f(x) = (x * x) / 2 using Exponential(1) distribution and retrieve sample points");
Console.Write(@"Points: ");
for (var i = 0; i < samplePoints.Length; i++)
@ -97,7 +97,7 @@ namespace Examples.SignalsExamples
// 3. Get 10 random samples of f(x, y) = (x * y) / 2 using ChiSquare(10) distribution
var chiSquare = new ChiSquared(10);
result = SignalGenerator.Random(TwoDomainFunction, chiSquare, 10);
result = Generate.RandomMap2(10, chiSquare, TwoDomainFunction);
Console.WriteLine(@" 3. Get 10 random samples of f(x, y) = (x * y) / 2 using ChiSquare(10) distribution");
for (var i = 0; i < result.Length; i++)
{

9
src/Examples/SpecialFunctions/ErrorFunction.cs

@ -26,7 +26,6 @@
using System;
using MathNet.Numerics;
using MathNet.Numerics.Signals;
namespace Examples.SpecialFunctionsExamples
{
@ -70,7 +69,7 @@ namespace Examples.SpecialFunctionsExamples
// 2. Sample 10 values of the error function in [-1.0; 1.0]
Console.WriteLine(@"2. Sample 10 values of the error function in [-1.0; 1.0]");
var data = SignalGenerator.EquidistantInterval(SpecialFunctions.Erf, -1.0, 1.0, 10);
var data = Generate.LinearSpacedMap(10, -1.0, 1.0, SpecialFunctions.Erf);
for (var i = 0; i < data.Length; i++)
{
Console.Write(data[i].ToString("N") + @" ");
@ -86,7 +85,7 @@ namespace Examples.SpecialFunctionsExamples
// 4. Sample 10 values of the complementary error function in [-1.0; 1.0]
Console.WriteLine(@"4. Sample 10 values of the complementary error function in [-1.0; 1.0]");
data = SignalGenerator.EquidistantInterval(SpecialFunctions.Erfc, -1.0, 1.0, 10);
data = Generate.LinearSpacedMap(10, -1.0, 1.0, SpecialFunctions.Erfc);
for (var i = 0; i < data.Length; i++)
{
Console.Write(data[i].ToString("N") + @" ");
@ -102,7 +101,7 @@ namespace Examples.SpecialFunctionsExamples
// 6. Sample 10 values of the inverse error function in [-1.0; 1.0]
Console.WriteLine(@"6. Sample 10 values of the inverse error function in [-1.0; 1.0]");
data = SignalGenerator.EquidistantInterval(SpecialFunctions.ErfInv, -1.0, 1.0, 10);
data = Generate.LinearSpacedMap(10, -1.0, 1.0, SpecialFunctions.ErfInv);
for (var i = 0; i < data.Length; i++)
{
Console.Write(data[i].ToString("N") + @" ");
@ -118,7 +117,7 @@ namespace Examples.SpecialFunctionsExamples
// 8. Sample 10 values of the complementary inverse error function in [-1.0; 1.0]
Console.WriteLine(@"8. Sample 10 values of the complementary inverse error function in [-1.0; 1.0]");
data = SignalGenerator.EquidistantInterval(SpecialFunctions.ErfcInv, -1.0, 1.0, 10);
data = Generate.LinearSpacedMap(10, -1.0, 1.0, SpecialFunctions.ErfcInv);
for (var i = 0; i < data.Length; i++)
{
Console.Write(data[i].ToString("N") + @" ");

6
src/Examples/Statistics.cs

@ -25,8 +25,8 @@
// </copyright>
using System;
using MathNet.Numerics;
using MathNet.Numerics.Distributions;
using MathNet.Numerics.Signals;
using MathNet.Numerics.Statistics;
namespace Examples
@ -124,8 +124,8 @@ namespace Examples
Console.WriteLine();
// 6. Correlation coefficient between 1000 samples of f(x) = x * 2 and f(x) = x * x
data = SignalGenerator.EquidistantInterval(x => x * 2, 0, 100, 1000);
dataB = SignalGenerator.EquidistantInterval(x => x * x, 0, 100, 1000);
data = Generate.LinearSpacedMap(1000, 0, 100, x => x * 2);
dataB = Generate.LinearSpacedMap(1000, 0, 100, x => x * x);
Console.WriteLine(@"7. Correlation coefficient between 1000 samples of f(x) = x * 2 and f(x) = x * x is {0}", Correlation.Pearson(data, dataB).ToString("N04"));
Console.WriteLine(@"8. Ranked correlation coefficient between 1000 samples of f(x) = x * 2 and f(x) = x * x is {0}", Correlation.Spearman(data, dataB).ToString("N04"));
Console.WriteLine();

18
src/FSharp/LinearAlgebra.Matrix.fs

@ -304,8 +304,8 @@ module Matrix =
A.MapIndexedInplace((fun i j x -> f i j), true)
/// Fold all columns into one row vector.
let inline foldByCol f acc (A: #Matrix<_>) =
let v = A.CreateVector(A.ColumnCount)
let inline foldByCol f acc (A: #Matrix<'T>) =
let v = Vector<'T>.Build.SameAs(A, A.ColumnCount)
for k=0 to A.ColumnCount-1 do
let mutable macc = acc
for i=0 to A.RowCount-1 do
@ -314,8 +314,8 @@ module Matrix =
v :> _ Vector
/// Fold all rows into one column vector.
let inline foldByRow f acc (A: #Matrix<_>) =
let v = A.CreateVector(A.RowCount)
let inline foldByRow f acc (A: #Matrix<'T>) =
let v = Vector<'T>.Build.SameAs(A, A.RowCount)
for k=0 to A.RowCount-1 do
let mutable macc = acc
for i=0 to A.ColumnCount-1 do
@ -350,6 +350,8 @@ module Matrix =
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module DenseMatrix =
open MathNet.Numerics.Distributions
/// Create a matrix that directly binds to a storage object.
let inline ofStorage storage = Matrix<'T>.Build.Dense(storage)
@ -360,7 +362,13 @@ module DenseMatrix =
let inline zero (rows: int) (cols: int) = Matrix<'T>.Build.Dense(rows, cols)
/// Create a random matrix with the given dimension and value distribution.
let inline random (rows: int) (cols: int) dist = Matrix<'T>.Build.Random(rows, cols, dist)
let inline random (rows: int) (cols: int) (dist: IContinuousDistribution) = Matrix<'T>.Build.Random(rows, cols, dist)
/// Create a random matrix with the given dimension and standard distributed values.
let inline randomStandard (rows: int) (cols: int) = Matrix<'T>.Build.Random(rows, cols)
/// Create a random matrix with the given dimension and standard distributed values using the provided seed.
let inline randomSeed (rows: int) (cols: int) (seed: int) = Matrix<'T>.Build.Random(rows, cols, seed)
/// Create a matrix with the given dimension and set all values to x.
let inline create (rows: int) (cols: int) (x: 'T) = Matrix<'T>.Build.Dense(rows, cols, x)

14
src/FSharp/LinearAlgebra.Vector.fs

@ -200,8 +200,8 @@ module Vector =
}
/// Creates a new vector and inserts the given value at the given index.
let inline insert index value (v: #Vector<_>) =
let newV = v.CreateVector(v.Count + 1)
let inline insert index value (v: #Vector<'T>) =
let newV = Vector<'T>.Build.SameAs(v, v.Count + 1)
v.CopySubVectorTo(newV, 0, 0, index)
v.CopySubVectorTo(newV, index, index+1, v.Count - index)
newV.At(index, value)
@ -221,6 +221,8 @@ module Vector =
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module DenseVector =
open MathNet.Numerics.Distributions
/// Create a vector that directly binds to a storage object.
let inline ofStorage (storage: Storage.DenseVectorStorage<'T>) = Vector<'T>.Build.Dense(storage)
@ -231,7 +233,13 @@ module DenseVector =
let inline zero (n: int) = Vector<'T>.Build.Dense(n)
/// Initialize a random vector with the given dimension and distribution.
let inline random (n: int) dist = Vector<'T>.Build.Random(n, dist)
let inline random (n: int) (dist: IContinuousDistribution) = Vector<'T>.Build.Random(n, dist)
/// Initialize a random vector with the given dimension and standard distributed values.
let inline randomStandard (n: int) = Vector<'T>.Build.Random(n)
/// Initialize a random vector with the given dimension and standard distributed values using the provided seed.
let inline randomSeed (n: int) (seed: int) = Vector<'T>.Build.Random(n, seed)
/// Initialize an x-valued vector with the given dimension.
let inline create (n: int) (x: 'T) = Vector<'T>.Build.Dense(n, x)

96
src/FSharp/Random.fs

@ -4,7 +4,7 @@
// http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com
//
// Copyright (c) 2009-2012 Math.NET
// Copyright (c) 2009-2013 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -33,55 +33,71 @@ namespace MathNet.Numerics.Random
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module Random =
/// Creates a default .Net system pRNG with a custom seed based on uinque GUIDs
let system () = new System.Random(RandomSeed.Guid())
let systemSeed seed = new System.Random(seed)
/// Returns the default random source, thread-safe and also thread-locally shared
let shared = SystemRandomSource.Default :> System.Random
/// Default sampling, efficient but without custom seed (uses robust seeds internally)
let inline doubles (length:int) = SystemRandomSource.Doubles(length)
let inline doubleSeq () = SystemRandomSource.DoubleSequence()
let inline doubleFill (values:double[]) = SystemRandomSource.Doubles(values)
let inline doublesSeed (seed:int) (length:int) = SystemRandomSource.Doubles(length, seed)
let inline doubleSeqSeed (seed:int) = SystemRandomSource.DoubleSequence(seed)
let inline doubleFillSeed (seed:int) (values:double[]) = SystemRandomSource.Doubles(values, seed)
/// Creates a default .Net system pRNG with a robust seed
let systemShared = shared
let inline system () = SystemRandomSource() :> System.Random
let inline systemSeed (seed:int) = SystemRandomSource(seed) :> System.Random
#if PORTABLE
#else
/// Creates a default .Net cryptographic system pRNG
let crypto () = new SystemCryptoRandomNumberGenerator() :> System.Random
let cryptoWith (threadSafe:bool) = new SystemCryptoRandomNumberGenerator(threadSafe) :> System.Random
let inline crypto () = new CryptoRandomSource() :> System.Random
let inline cryptoWith (threadSafe:bool) = new CryptoRandomSource(threadSafe) :> System.Random
let inline cryptoDoubles length = CryptoRandomSource.Doubles(length)
let inline cryptoDoubleSeq () = CryptoRandomSource.DoubleSequence()
#endif
/// Creates a Mersenne Twister 19937 pRNG with a custom seed based on uinque GUIDs
let mersenneTwister () = new MersenneTwister() :> System.Random
let mersenneTwisterSeed (seed:int) = new MersenneTwister(seed) :> System.Random
let mersenneTwisterWith seed threadSafe = new MersenneTwister(seed, threadSafe) :> System.Random
/// Creates a Mersenne Twister 19937 pRNG with a robust seed
let mersenneTwisterShared = MersenneTwister.Default :> System.Random
let inline mersenneTwister () = MersenneTwister() :> System.Random
let inline mersenneTwisterSeed (seed:int) = MersenneTwister(seed) :> System.Random
let inline mersenneTwisterWith (seed:int) threadSafe = MersenneTwister(seed, threadSafe) :> System.Random
/// Creates a multiply-with-carry Xorshift (Xn = a * Xn−3 + c mod 2^32) pRNG with a custom seed based on uinque GUIDs
let xorshift () = new Xorshift() :> System.Random
let xorshiftSeed (seed:int) = new Xorshift(seed) :> System.Random
let xorshiftWith seed threadSafe = new Xorshift(seed, threadSafe) :> System.Random
let xorshiftCustom seed threadSafe a c x1 x2 = new Xorshift(seed, threadSafe, a, c, x1, x2) :> System.Random
/// Creates a multiply-with-carry Xorshift (Xn = a * Xn−3 + c mod 2^32) pRNG with a robust seed
let inline xorshift () = Xorshift() :> System.Random
let inline xorshiftSeed (seed:int) = Xorshift(seed) :> System.Random
let inline xorshiftWith (seed:int) threadSafe = Xorshift(seed, threadSafe) :> System.Random
let inline xorshiftCustom (seed:int) threadSafe a c x1 x2 = Xorshift(seed, threadSafe, a, c, x1, x2) :> System.Random
/// Creates a Wichmann-Hill’s 1982 combined multiplicative congruential pRNG with a custom seed based on uinque GUIDs
let wh1982 () = new WH1982() :> System.Random
let wh1982Seed (seed:int) = new WH1982(seed) :> System.Random
let wh1982With seed threadSafe = new WH1982(seed, threadSafe) :> System.Random
/// Creates a Wichmann-Hill’s 1982 combined multiplicative congruential pRNG with a robust seed
let inline wh1982 () = WH1982() :> System.Random
let inline wh1982Seed (seed:int) = WH1982(seed) :> System.Random
let inline wh1982With (seed:int) threadSafe = WH1982(seed, threadSafe) :> System.Random
/// Creates a Wichmann-Hill’s 2006 combined multiplicative congruential pRNG with a custom seed based on uinque GUIDs
let wh2006 () = new WH2006() :> System.Random
let wh2006Seed (seed:int) = new WH2006(seed) :> System.Random
let wh2006With seed threadSafe = new WH2006(seed, threadSafe) :> System.Random
/// Creates a Wichmann-Hill’s 2006 combined multiplicative congruential pRNG with a robust seed
let inline wh2006 () = WH2006() :> System.Random
let inline wh2006Seed (seed:int) = WH2006(seed) :> System.Random
let inline wh2006With (seed:int) threadSafe = WH2006(seed, threadSafe) :> System.Random
/// Creates a Parallel Additive Lagged Fibonacci pRNG with a custom seed based on uinque GUIDs
let palf () = new Palf() :> System.Random
let palfSeed (seed:int) = new Palf(seed) :> System.Random
let palfWith seed threadSafe = new Palf(seed, threadSafe, 418, 1279) :> System.Random
let palfCustom seed threadSafe shortLag longLag = new Palf(seed, threadSafe, shortLag, longLag) :> System.Random
/// Creates a Parallel Additive Lagged Fibonacci pRNG with a robust seed
let inline palf () = Palf() :> System.Random
let inline palfSeed (seed:int) = Palf(seed) :> System.Random
let inline palfWith (seed:int) threadSafe = Palf(seed, threadSafe, 418, 1279) :> System.Random
let inline palfCustom (seed:int) threadSafe shortLag longLag = Palf(seed, threadSafe, shortLag, longLag) :> System.Random
/// Creates a Multiplicative congruential generator using a modulus of 2^59 and a multiplier of 13^13 pRNG with a custom seed based on uinque GUIDs
let mcg59 () = new Mcg59() :> System.Random
let mcg59Seed (seed:int) = new Mcg59(seed) :> System.Random
let mcg59With seed threadSafe = new Mcg59(seed, threadSafe) :> System.Random
/// Creates a Multiplicative congruential generator using a modulus of 2^59 and a multiplier of 13^13 pRNG with a robust seed
let inline mcg59 () = Mcg59() :> System.Random
let inline mcg59Seed (seed:int) = Mcg59(seed) :> System.Random
let inline mcg59With (seed:int) threadSafe = Mcg59(seed, threadSafe) :> System.Random
/// Creates a Multiplicative congruential generator using a modulus of 2^31-1 and a multiplier of 1132489760 pRNG with a custom seed based on uinque GUIDs
let mcg31m1 () = new Mcg31m1() :> System.Random
let mcg31m1Seed (seed:int) = new Mcg31m1(seed) :> System.Random
let mcg31m1With seed threadSafe = new Mcg31m1(seed, threadSafe) :> System.Random
/// Creates a Multiplicative congruential generator using a modulus of 2^31-1 and a multiplier of 1132489760 pRNG with a robust seed
let inline mcg31m1 () = Mcg31m1() :> System.Random
let inline mcg31m1Seed (seed:int) = Mcg31m1(seed) :> System.Random
let inline mcg31m1With (seed:int) threadSafe = Mcg31m1(seed, threadSafe) :> System.Random
/// Creates a 32-bit combined multiple recursive generator with 2 components of order 3 pRNG with a custom seed based on uinque GUIDs
let mrg32k3a () = new Mrg32k3a() :> System.Random
let mrg32k3aSeed (seed:int) = new Mrg32k3a(seed) :> System.Random
let mrg32k3aWith seed threadSafe = new Mrg32k3a(seed, threadSafe) :> System.Random
/// Creates a 32-bit combined multiple recursive generator with 2 components of order 3 pRNG with a robust seed
let inline mrg32k3a () = Mrg32k3a() :> System.Random
let inline mrg32k3aSeed (seed:int) = Mrg32k3a(seed) :> System.Random
let inline mrg32k3aWith (seed:int) threadSafe = Mrg32k3a(seed, threadSafe) :> System.Random

0
src/NativeWrappers/.gitignore → src/NativeProviders/.gitignore

0
src/NativeWrappers/ATLAS/blas.c → src/NativeProviders/ATLAS/blas.c

0
src/NativeWrappers/ATLAS/blas.h → src/NativeProviders/ATLAS/blas.h

0
src/NativeWrappers/ATLAS/lapack.cpp → src/NativeProviders/ATLAS/lapack.cpp

0
src/NativeWrappers/Common/WindowsDLL.cpp → src/NativeProviders/Common/WindowsDLL.cpp

0
src/NativeWrappers/Common/lapack_common.h → src/NativeProviders/Common/lapack_common.h

0
src/NativeWrappers/Common/resource.h → src/NativeProviders/Common/resource.h

2
src/NativeWrappers/Common/resource.rc → src/NativeProviders/Common/resource.rc

@ -69,7 +69,7 @@ BEGIN
BEGIN
VALUE "Comments", "http://numerics.mathdotnet.com/"
VALUE "CompanyName", "Math.NET"
VALUE "FileDescription", "MathNET Numerics Native Wrapper"
VALUE "FileDescription", "MathNET Numerics Native Provider"
VALUE "FileVersion", "1.3.0.0"
VALUE "InternalName", "Math.NET"
VALUE "LegalCopyright", "Copyright (C) Math.NET 2009-2013"

0
src/NativeWrappers/Common/wrapper_common.h → src/NativeProviders/Common/wrapper_common.h

0
src/NativeWrappers/Linux/mkl_build.sh → src/NativeProviders/Linux/mkl_build.sh

0
src/NativeWrappers/MKL/blas.c → src/NativeProviders/MKL/blas.c

0
src/NativeWrappers/MKL/lapack.cpp → src/NativeProviders/MKL/lapack.cpp

0
src/NativeWrappers/MKL/optimization.cpp → src/NativeProviders/MKL/optimization.cpp

0
src/NativeWrappers/MKL/vector_functions.c → src/NativeProviders/MKL/vector_functions.c

19
src/NativeWrappers/Windows/ATLASWrapper/ATLASWrapper.vcxproj → src/NativeProviders/Windows/ATLAS/ATLASWrapper.vcxproj

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
@ -22,31 +22,32 @@
<ProjectGuid>{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>ATLASWrapper</RootNamespace>
<ProjectName>ATLAS</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
@ -69,22 +70,22 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>D:\Source\ATLAS\include;..\..\Common;$(IncludePath)</IncludePath>
<OutDir>$(SolutionDir)..\..\..\..\ATLAS\Windows\x86\</OutDir>
<OutDir>$(ProjectDir)..\..\..\..\out\ATLAS\Windows\x86\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>D:\Source\ATLAS\include;..\..\Common;$(IncludePath)</IncludePath>
<OutDir>$(SolutionDir)..\..\..\..\ATLAS\Windows\x64\</OutDir>
<OutDir>$(ProjectDir)..\..\..\..\out\ATLAS\Windows\x64\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>D:\Source\ATLAS\include;..\..\Common;$(IncludePath)</IncludePath>
<OutDir>$(SolutionDir)..\..\..\..\ATLAS\Windows\x86\</OutDir>
<OutDir>$(ProjectDir)..\..\..\..\out\ATLAS\Windows\x86\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>D:\Source\ATLAS\include;..\..\Common;$(IncludePath)</IncludePath>
<OutDir>$(SolutionDir)..\..\..\..\ATLAS\Windows\x64\</OutDir>
<OutDir>$(ProjectDir)..\..\..\..\out\ATLAS\Windows\x64\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>

0
src/NativeWrappers/Windows/ATLASWrapper/ATLASWrapper.vcxproj.filters → src/NativeProviders/Windows/ATLAS/ATLASWrapper.vcxproj.filters

0
src/NativeWrappers/Windows/ATLAS/ATLASWrapper.vcproj → src/NativeProviders/Windows/ATLASEx/ATLASWrapper.vcproj

0
src/NativeWrappers/Windows/ATLAS/ATLASWrapper.vcxproj → src/NativeProviders/Windows/ATLASEx/ATLASWrapper.vcxproj

0
src/NativeWrappers/Windows/ATLAS/ATLASWrapper.vcxproj.filters → src/NativeProviders/Windows/ATLASEx/ATLASWrapper.vcxproj.filters

0
src/NativeWrappers/Windows/MKL/MKLWrapper.vcproj → src/NativeProviders/Windows/MKL/MKLWrapper.vcproj

40
src/NativeWrappers/Windows/MKL/MKLWrapper.vcxproj → src/NativeProviders/Windows/MKL/MKLWrapper.vcxproj

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
@ -29,43 +29,44 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}</ProjectGuid>
<RootNamespace>MKLWrapper</RootNamespace>
<ProjectName>MKL</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<UseIntelMKL>Parallel</UseIntelMKL>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<UseIntelMKL>Parallel</UseIntelMKL>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Intel_SSA|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>Intel C++ Compiler XE 13.0</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<UseIntelMKL>Parallel</UseIntelMKL>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<UseIntelMKL>Parallel</UseIntelMKL>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<UseIntelMKL>Parallel</UseIntelMKL>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Intel_SSA|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>Intel C++ Compiler XE 13.0</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<UseIntelMKL>Parallel</UseIntelMKL>
</PropertyGroup>
@ -95,32 +96,32 @@
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)..\..\..\..\MKL\Windows\x86\</OutDir>
<OutDir>$(ProjectDir)..\..\..\..\out\MKL\Windows\x86\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetName>MathNet.Numerics.MKL</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Intel_SSA|Win32'">
<OutDir>$(SolutionDir)..\..\..\..\MKL\Windows\x86\</OutDir>
<OutDir>$(ProjectDir)..\..\..\..\out\MKL\Windows\x86\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetName>MathNet.Numerics.MKL</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)..\..\..\..\MKL\Windows\x64\</OutDir>
<OutDir>$(ProjectDir)..\..\..\..\out\MKL\Windows\x64\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetName>MathNet.Numerics.MKL</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Intel_SSA|x64'">
<OutDir>$(SolutionDir)..\..\..\..\MKL\Windows\x64\</OutDir>
<OutDir>$(ProjectDir)..\..\..\..\out\MKL\Windows\x64\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetName>MathNet.Numerics.MKL</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)..\..\..\..\MKL\Windows\x86\</OutDir>
<OutDir>$(ProjectDir)..\..\..\..\out\MKL\Windows\x86\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetName>MathNet.Numerics.MKL</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)..\..\..\..\MKL\Windows\x64\</OutDir>
<OutDir>$(ProjectDir)..\..\..\..\out\MKL\Windows\x64\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetName>MathNet.Numerics.MKL</TargetName>
</PropertyGroup>
@ -145,7 +146,7 @@
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
</Link>
<PostBuildEvent>
<Command>copy "$(CompilerPathForVC)\libiomp5md.dll" $(OutputPath)</Command>
<Command>copy "$(INTEL_DEV_REDIST)redist\ia32\compiler\libiomp5md.dll" $(OutputPath)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Intel_SSA|Win32'">
@ -171,7 +172,7 @@
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
</Link>
<PostBuildEvent>
<Command>copy "$(CompilerPathForVC)\libiomp5md.dll" $(OutputPath)</Command>
<Command>copy "$(INTEL_DEV_REDIST)redist\ia32\compiler\libiomp5md.dll" $(OutputPath)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -198,7 +199,7 @@
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
</Link>
<PostBuildEvent>
<Command>copy "$(CompilerPathForVC)\libiomp5md.dll" $(OutputPath)</Command>
<Command>copy "$(INTEL_DEV_REDIST)redist\intel64\compiler\libiomp5md.dll" $(OutputPath)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Intel_SSA|x64'">
@ -227,7 +228,7 @@
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
</Link>
<PostBuildEvent>
<Command>copy "$(CompilerPathForVC)\libiomp5md.dll" $(OutputPath)</Command>
<Command>copy "$(INTEL_DEV_REDIST)redist\intel64\compiler\libiomp5md.dll" $(OutputPath)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -253,9 +254,8 @@
<TargetMachine>MachineX86</TargetMachine>
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
</Link>
<PostBuildEvent />
<PostBuildEvent>
<Command>copy "$(CompilerPathForVC)\libiomp5md.dll" $(OutputPath)</Command>
<Command>copy "$(INTEL_DEV_REDIST)redist\ia32\compiler\libiomp5md.dll" $(OutputPath)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -285,7 +285,7 @@
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
</Link>
<PostBuildEvent>
<Command>copy "$(CompilerPathForVC)\libiomp5md.dll" $(OutputPath)</Command>
<Command>copy "$(INTEL_DEV_REDIST)redist\intel64\compiler\libiomp5md.dll" $(OutputPath)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>

0
src/NativeWrappers/Windows/MKL/MKLWrapper.vcxproj.filters → src/NativeProviders/Windows/MKL/MKLWrapper.vcxproj.filters

53
src/NativeWrappers/Windows/NativeWrappers.sln

@ -1,53 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{5A0892FF-82CE-40FC-BCE1-73810C615F52}"
ProjectSection(SolutionItems) = preProject
..\Common\lapack_common.h = ..\Common\lapack_common.h
..\Common\resource.h = ..\Common\resource.h
..\Common\resource.rc = ..\Common\resource.rc
..\Common\WindowsDLL.cpp = ..\Common\WindowsDLL.cpp
..\Common\wrapper_common.h = ..\Common\wrapper_common.h
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MKLWrapper", "MKL\MKLWrapper.vcxproj", "{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ATLASWrapper", "ATLASWrapper\ATLASWrapper.vcxproj", "{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Mixed Platforms = Release|Mixed Platforms
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Debug|Win32.ActiveCfg = Debug|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Debug|Win32.Build.0 = Debug|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Debug|x64.ActiveCfg = Debug|x64
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Debug|x64.Build.0 = Debug|x64
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Release|Mixed Platforms.Build.0 = Release|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Release|Win32.ActiveCfg = Release|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Release|Win32.Build.0 = Release|Win32
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Release|x64.ActiveCfg = Release|x64
{C0B0DBA9-7FB0-4C87-BDB1-3EED19DC2B8F}.Release|x64.Build.0 = Release|x64
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Debug|Win32.ActiveCfg = Debug|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Debug|Win32.Build.0 = Debug|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Debug|x64.ActiveCfg = Debug|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Release|Mixed Platforms.Build.0 = Release|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Release|Win32.ActiveCfg = Release|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Release|Win32.Build.0 = Release|Win32
{2362B8AC-C52B-45E4-A1BF-C682A4DB4220}.Release|x64.ActiveCfg = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

134
src/Numerics/Compatibility.cs

@ -0,0 +1,134 @@
#if PORTABLE
namespace MathNet.Numerics
{
using System;
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
public class SerializableAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public class SpecialNameAttribute : Attribute
{
}
}
#endif
#if (PORTABLE || NET35)
namespace MathNet.Numerics
{
using System;
[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public class TargetedPatchingOptOutAttribute : Attribute
{
public string Reason { get; private set; }
public TargetedPatchingOptOutAttribute(string reason)
{
Reason = reason;
}
}
}
#endif
#if NET35
namespace MathNet.Numerics
{
using System;
using System.Collections.Generic;
internal static class ObjectComparer
{
internal static int Compare<T>(T a, T b)
{
if (ReferenceEquals(a, null)) return -1;
if (ReferenceEquals(b, null)) return 1;
if (Equals(a, b)) return 0;
return Comparer<T>.Default.Compare(a, b);
}
}
public class Tuple<T1, T2> : IComparable, IComparable<Tuple<T1, T2>>
{
public T1 Item1 { get; set; }
public T2 Item2 { get; set; }
public Tuple(T1 item1, T2 item2)
{
Item1 = item1;
Item2 = item2;
}
public int CompareTo(object obj)
{
if (obj == null) return 1;
var other = obj as Tuple<T1, T2>;
if (other == null) throw new ArgumentException();
return CompareTo(other);
}
public int CompareTo(Tuple<T1, T2> other)
{
if (other == null) return 1;
int a = ObjectComparer.Compare(Item1, other.Item1);
return a != 0 ? a : ObjectComparer.Compare(Item2, other.Item2);
}
}
public class Tuple<T1, T2, T3> : IComparable, IComparable<Tuple<T1, T2, T3>>
{
public T1 Item1 { get; set; }
public T2 Item2 { get; set; }
public T3 Item3 { get; set; }
public Tuple(T1 item1, T2 item2, T3 item3)
{
Item1 = item1;
Item2 = item2;
Item3 = item3;
}
public int CompareTo(object obj)
{
if (obj == null) return 1;
var other = obj as Tuple<T1, T2, T3>;
if (other == null) throw new ArgumentException();
return CompareTo(other);
}
public int CompareTo(Tuple<T1, T2, T3> other)
{
if (other == null) return 1;
int a = ObjectComparer.Compare(Item1, other.Item1);
if (a != 0) return a;
int b = ObjectComparer.Compare(Item2, other.Item2);
return b != 0 ? b : ObjectComparer.Compare(Item3, other.Item3);
}
}
public static class EnumerableExtensions
{
public static IEnumerable<T> Zip<TA, TB, T>(this IEnumerable<TA> seqA, IEnumerable<TB> seqB, Func<TA, TB, T> func)
{
if (seqA == null) throw new ArgumentNullException("seqA");
if (seqB == null) throw new ArgumentNullException("seqB");
return Zip35Deferred(seqA, seqB, func);
}
private static IEnumerable<T> Zip35Deferred<A, B, T>(IEnumerable<A> seqA, IEnumerable<B> seqB, Func<A, B, T> func)
{
using (var iteratorA = seqA.GetEnumerator())
using (var iteratorB = seqB.GetEnumerator())
{
while (iteratorA.MoveNext() && iteratorB.MoveNext())
{
yield return func(iteratorA.Current, iteratorB.Current);
}
}
}
}
}
#endif

6
src/Numerics/Complex64.cs

@ -698,7 +698,11 @@ namespace MathNet.Numerics
}
}
var value = GlobalizationHelper.ParseSingle(ref token);
#if PORTABLE
var value = GlobalizationHelper.ParseDouble(ref token);
#else
var value = GlobalizationHelper.ParseDouble(ref token, format.GetCultureInfo());
#endif
// handle suffix imaginary symbol
if (token != null && (String.Compare(token.Value, "i", StringComparison.OrdinalIgnoreCase) == 0

32
src/Numerics/Control.cs

@ -38,10 +38,11 @@ namespace MathNet.Numerics
/// </summary>
public static class Control
{
private static int _numberOfThreads;
private static int _blockSize;
private static int _parallelizeOrder;
private static int _parallelizeElements;
static int _numberOfThreads;
static int _blockSize;
static int _parallelizeOrder;
static int _parallelizeElements;
static ILinearAlgebraProvider _linearAlgebraProvider;
static Control()
{
@ -66,10 +67,8 @@ namespace MathNet.Numerics
_parallelizeElements = 300;
// Linear Algebra Provider
#if PORTABLE
// GetEnvironmentVariable is not available in portable!
LinearAlgebraProvider = new ManagedLinearAlgebraProvider();
#else
#if !PORTABLE
try
{
const string name = "MathNetNumericsLAProvider";
@ -81,14 +80,11 @@ namespace MathNet.Numerics
LinearAlgebraProvider = new Providers.LinearAlgebra.Mkl.MklLinearAlgebraProvider();
break;
#endif
default:
LinearAlgebraProvider = new ManagedLinearAlgebraProvider();
break;
}
}
catch
{
// We don't care about any failures here at all
// We don't care about any failures here at all (because "auto")
LinearAlgebraProvider = new ManagedLinearAlgebraProvider();
}
#endif
@ -135,10 +131,20 @@ namespace MathNet.Numerics
public static bool DisableParallelization { get; set; }
/// <summary>
/// Gets or sets the linear algebra provider.
/// Gets or sets the linear algebra provider. Consider to use UseNativeMKL or UseManaged instead.
/// </summary>
/// <value>The linear algebra provider.</value>
public static ILinearAlgebraProvider LinearAlgebraProvider { get; set; }
public static ILinearAlgebraProvider LinearAlgebraProvider
{
get { return _linearAlgebraProvider; }
set
{
value.InitializeVerify();
// only actually set if verification did not throw
_linearAlgebraProvider = value;
}
}
/// <summary>
/// Gets or sets a value indicating how many parallel worker threads shall be used

86
src/Numerics/Distance.cs

@ -29,8 +29,10 @@
// </copyright>
using System;
using System.Collections.Generic;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Statistics;
namespace MathNet.Numerics
{
@ -244,6 +246,82 @@ namespace MathNet.Numerics
return max;
}
/// <summary>
/// Minkowski Distance, i.e. the generalized p-norm of the difference.
/// </summary>
public static double Minkowski<T>(double p, Vector<T> a, Vector<T> b) where T : struct, IEquatable<T>, IFormattable
{
return (a - b).Norm(p);
}
/// <summary>
/// Minkowski Distance, i.e. the generalized p-norm of the difference.
/// </summary>
public static double Minkowski(double p, double[] a, double[] b)
{
if (a.Length != b.Length) throw new ArgumentException(Resources.ArgumentVectorsSameLength);
if (p < 0d) throw new ArgumentOutOfRangeException("p");
if (p == 1d) return Manhattan(a, b);
if (p == 2d) return Euclidean(a, b);
if (double.IsPositiveInfinity(p)) return Chebyshev(a, b);
double sum = 0d;
for (var i = 0; i < a.Length; i++)
{
sum += Math.Pow(Math.Abs(a[i] - b[i]), p);
}
return Math.Pow(sum, 1.0 / p);
}
/// <summary>
/// Minkowski Distance, i.e. the generalized p-norm of the difference.
/// </summary>
public static float Minkowski(double p, float[] a, float[] b)
{
if (a.Length != b.Length) throw new ArgumentException(Resources.ArgumentVectorsSameLength);
if (p < 0d) throw new ArgumentOutOfRangeException("p");
if (p == 1d) return Manhattan(a, b);
if (p == 2d) return Euclidean(a, b);
if (double.IsPositiveInfinity(p)) return Chebyshev(a, b);
double sum = 0d;
for (var i = 0; i < a.Length; i++)
{
sum += Math.Pow(Math.Abs(a[i] - b[i]), p);
}
return (float) Math.Pow(sum, 1.0/p);
}
/// <summary>
/// Canberra Distance, a weighted version of the L1-norm of the difference.
/// </summary>
public static double Canberra(double[] a, double[] b)
{
if (a.Length != b.Length) throw new ArgumentException(Resources.ArgumentVectorsSameLength);
double sum = 0d;
for (var i = 0; i < a.Length; i++)
{
sum += Math.Abs(a[i] - b[i]) / (Math.Abs(a[i]) + Math.Abs(b[i]));
}
return sum;
}
/// <summary>
/// Canberra Distance, a weighted version of the L1-norm of the difference.
/// </summary>
public static float Canberra(float[] a, float[] b)
{
if (a.Length != b.Length) throw new ArgumentException(Resources.ArgumentVectorsSameLength);
float sum = 0f;
for (var i = 0; i < a.Length; i++)
{
sum += Math.Abs(a[i] - b[i]) / (Math.Abs(a[i]) + Math.Abs(b[i]));
}
return sum;
}
/// <summary>
/// Hamming Distance, i.e. the number of positions that have different values in the vectors.
/// </summary>
@ -277,5 +355,13 @@ namespace MathNet.Numerics
}
return count;
}
/// <summary>
/// Pearson's distance, i.e. 1 - the person correlation coefficient.
/// </summary>
public static double Pearson(IEnumerable<double> a, IEnumerable<double> b)
{
return 1.0 - Correlation.Pearson(a, b);
}
}
}

14
src/Numerics/Distributions/Bernoulli.cs

@ -31,6 +31,7 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
@ -40,11 +41,6 @@ namespace MathNet.Numerics.Distributions
/// p specifies the probability that a 1 is generated.
/// <a href="http://en.wikipedia.org/wiki/Bernoulli_distribution">Wikipedia - Bernoulli distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class Bernoulli : IDiscreteDistribution
{
System.Random _random;
@ -58,7 +54,7 @@ namespace MathNet.Numerics.Distributions
/// <exception cref="ArgumentOutOfRangeException">If the Bernoulli parameter is not in the range [0,1].</exception>
public Bernoulli(double p)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(p);
}
@ -70,7 +66,7 @@ namespace MathNet.Numerics.Distributions
/// <exception cref="ArgumentOutOfRangeException">If the Bernoulli parameter is not in the range [0,1].</exception>
public Bernoulli(double p, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(p);
}
@ -84,7 +80,7 @@ namespace MathNet.Numerics.Distributions
}
/// <summary>
/// Checks whether the parameters of the distribution are valid.
/// Checks whether the parameters of the distribution are valid.
/// </summary>
/// <param name="p">The probability (p) of generating one. Range: 0 ≤ p ≤ 1.</param>
/// <returns><c>true</c> when the parameters are valid, <c>false</c> otherwise.</returns>
@ -123,7 +119,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

21
src/Numerics/Distributions/Beta.cs

@ -31,26 +31,23 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
/// <summary>
/// Continuous Univariate Beta distribution.
/// For details about this distribution, see
/// For details about this distribution, see
/// <a href="http://en.wikipedia.org/wiki/Beta_distribution">Wikipedia - Beta distribution</a>.
/// </summary>
/// <remarks>
/// <para>There are a few special cases for the parameterization of the Beta distribution. When both
/// There are a few special cases for the parameterization of the Beta distribution. When both
/// shape parameters are positive infinity, the Beta distribution degenerates to a point distribution
/// at 0.5. When one of the shape parameters is positive infinity, the distribution degenerates to a point
/// distribution at the positive infinity. When both shape parameters are 0.0, the Beta distribution
/// distribution at the positive infinity. When both shape parameters are 0.0, the Beta distribution
/// degenerates to a Bernoulli distribution with parameter 0.5. When one shape parameter is 0.0, the
/// distribution degenerates to a point distribution at the non-zero shape parameter.</para>
/// <para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can get/set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
/// distribution degenerates to a point distribution at the non-zero shape parameter.
/// </remarks>
public class Beta : IContinuousDistribution
{
System.Random _random;
@ -65,7 +62,7 @@ namespace MathNet.Numerics.Distributions
/// <param name="b">The β shape parameter of the Beta distribution. Range: β ≥ 0.</param>
public Beta(double a, double b)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(a, b);
}
@ -77,7 +74,7 @@ namespace MathNet.Numerics.Distributions
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
public Beta(double a, double b, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(a, b);
}
@ -131,7 +128,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

20
src/Numerics/Distributions/Binomial.cs

@ -31,20 +31,18 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
/// <summary>
/// Discrete Univariate Binomial distribution.
/// For details about this distribution, see
/// For details about this distribution, see
/// <a href="http://en.wikipedia.org/wiki/Binomial_distribution">Wikipedia - Binomial distribution</a>.
/// </summary>
/// <remarks><para>The distribution is parameterized by a probability (between 0.0 and 1.0).</para>
/// <para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
/// <remarks>
/// The distribution is parameterized by a probability (between 0.0 and 1.0).
/// </remarks>
public class Binomial : IDiscreteDistribution
{
System.Random _random;
@ -61,7 +59,7 @@ namespace MathNet.Numerics.Distributions
/// <exception cref="ArgumentOutOfRangeException">If <paramref name="n"/> is negative.</exception>
public Binomial(double p, int n)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(p, n);
}
@ -75,7 +73,7 @@ namespace MathNet.Numerics.Distributions
/// <exception cref="ArgumentOutOfRangeException">If <paramref name="n"/> is negative.</exception>
public Binomial(double p, int n, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(p, n);
}
@ -89,7 +87,7 @@ namespace MathNet.Numerics.Distributions
}
/// <summary>
/// Checks whether the parameters of the distribution are valid.
/// Checks whether the parameters of the distribution are valid.
/// </summary>
/// <param name="p">The success probability (p) in each trial. Range: 0 ≤ p ≤ 1.</param>
/// <param name="n">The number of trials (n). Range: n ≥ 0.</param>
@ -141,7 +139,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

36
src/Numerics/Distributions/Categorical.cs

@ -32,24 +32,22 @@ using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Statistics;
namespace MathNet.Numerics.Distributions
{
/// <summary>
/// Discrete Univariate Categorical distribution.
/// For details about this distribution, see
/// For details about this distribution, see
/// <a href="http://en.wikipedia.org/wiki/Categorical_distribution">Wikipedia - Categorical distribution</a>. This
/// distribution is sometimes called the Discrete distribution.
/// </summary>
/// <remarks><para>The distribution is parameterized by a vector of ratios: in other words, the parameter
/// <remarks>
/// The distribution is parameterized by a vector of ratios: in other words, the parameter
/// does not have to be normalized and sum to 1. The reason is that some vectors can't be exactly normalized
/// to sum to 1 in floating point representation.</para>
/// <para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
/// to sum to 1 in floating point representation.
/// </remarks>
public class Categorical : IDiscreteDistribution
{
System.Random _random;
@ -60,30 +58,30 @@ namespace MathNet.Numerics.Distributions
/// <summary>
/// Initializes a new instance of the Categorical class.
/// </summary>
/// <param name="probabilityMass">An array of nonnegative ratios: this array does not need to be normalized
/// <param name="probabilityMass">An array of nonnegative ratios: this array does not need to be normalized
/// as this is often impossible using floating point arithmetic.</param>
/// <exception cref="ArgumentException">If any of the probabilities are negative or do not sum to one.</exception>
public Categorical(double[] probabilityMass)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(probabilityMass);
}
/// <summary>
/// Initializes a new instance of the Categorical class.
/// </summary>
/// <param name="probabilityMass">An array of nonnegative ratios: this array does not need to be normalized
/// <param name="probabilityMass">An array of nonnegative ratios: this array does not need to be normalized
/// as this is often impossible using floating point arithmetic.</param>
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
/// <exception cref="ArgumentException">If any of the probabilities are negative or do not sum to one.</exception>
public Categorical(double[] probabilityMass, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(probabilityMass);
}
/// <summary>
/// Initializes a new instance of the Categorical class from a <paramref name="histogram"/>. The distribution
/// Initializes a new instance of the Categorical class from a <paramref name="histogram"/>. The distribution
/// will not be automatically updated when the histogram changes. The categorical distribution will have
/// one value for each bucket and a probability for that value proportional to the bucket count.
/// </summary>
@ -104,7 +102,7 @@ namespace MathNet.Numerics.Distributions
p[i] = histogram[i].Count;
}
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(p);
}
@ -118,7 +116,7 @@ namespace MathNet.Numerics.Distributions
}
/// <summary>
/// Checks whether the parameters of the distribution are valid.
/// Checks whether the parameters of the distribution are valid.
/// </summary>
/// <param name="p">An array of nonnegative ratios: this array does not need to be normalized as this is often impossible using floating point arithmetic.</param>
/// <returns>If any of the probabilities are negative returns <c>false</c>, or if the sum of parameters is 0.0; otherwise <c>true</c></returns>
@ -140,7 +138,7 @@ namespace MathNet.Numerics.Distributions
}
/// <summary>
/// Checks whether the parameters of the distribution are valid.
/// Checks whether the parameters of the distribution are valid.
/// </summary>
/// <param name="cdf">An array of nonnegative ratios: this array does not need to be normalized as this is often impossible using floating point arithmetic.</param>
/// <returns>If any of the probabilities are negative returns <c>false</c>, or if the sum of parameters is 0.0; otherwise <c>true</c></returns>
@ -164,7 +162,7 @@ namespace MathNet.Numerics.Distributions
/// <summary>
/// Sets the parameters of the distribution after checking their validity.
/// </summary>
/// <param name="p">An array of nonnegative ratios: this array does not need to be normalized
/// <param name="p">An array of nonnegative ratios: this array does not need to be normalized
/// as this is often impossible using floating point arithmetic.</param>
/// <exception cref="ArgumentOutOfRangeException">When the parameters are out of range.</exception>
void SetParameters(double[] p)
@ -207,7 +205,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>
@ -400,7 +398,7 @@ namespace MathNet.Numerics.Distributions
/// Computes the cumulative distribution function. This method performs no parameter checking.
/// If the probability mass was normalized, the resulting cumulative distribution is normalized as well (up to numerical errors).
/// </summary>
/// <param name="pmfUnnormalized">An array of nonnegative ratios: this array does not need to be normalized
/// <param name="pmfUnnormalized">An array of nonnegative ratios: this array does not need to be normalized
/// as this is often impossible using floating point arithmetic.</param>
/// <returns>An array representing the unnormalized cumulative distribution function.</returns>
internal static double[] ProbabilityMassToCumulativeDistribution(double[] pmfUnnormalized)

18
src/Numerics/Distributions/Cauchy.cs

@ -31,19 +31,15 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
/// <summary>
/// Continuous Univariate Cauchy distribution.
/// The Cauchy distribution is a symmetric continuous probability distribution. For details about this distribution, see
/// The Cauchy distribution is a symmetric continuous probability distribution. For details about this distribution, see
/// <a href="http://en.wikipedia.org/wiki/Cauchy_distribution">Wikipedia - Cauchy distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can get/set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class Cauchy : IContinuousDistribution
{
System.Random _random;
@ -59,25 +55,25 @@ namespace MathNet.Numerics.Distributions
}
/// <summary>
/// Initializes a new instance of the <see cref="Cauchy"/> class.
/// Initializes a new instance of the <see cref="Cauchy"/> class.
/// </summary>
/// <param name="location">The location (x0) of the distribution.</param>
/// <param name="scale">The scale (γ) of the distribution. Range: γ > 0.</param>
public Cauchy(double location, double scale)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(location, scale);
}
/// <summary>
/// Initializes a new instance of the <see cref="Cauchy"/> class.
/// Initializes a new instance of the <see cref="Cauchy"/> class.
/// </summary>
/// <param name="location">The location (x0) of the distribution.</param>
/// <param name="scale">The scale (γ) of the distribution. Range: γ > 0.</param>
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
public Cauchy(double location, double scale, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(location, scale);
}
@ -131,7 +127,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

20
src/Numerics/Distributions/Chi.cs

@ -31,21 +31,17 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
/// <summary>
/// Continuous Univariate Chi distribution.
/// This distribution is a continuous probability distribution. The distribution usually arises when a k-dimensional vector's orthogonal
/// components are independent and each follow a standard normal distribution. The length of the vector will
/// This distribution is a continuous probability distribution. The distribution usually arises when a k-dimensional vector's orthogonal
/// components are independent and each follow a standard normal distribution. The length of the vector will
/// then have a chi distribution.
/// <a href="http://en.wikipedia.org/wiki/Chi_distribution">Wikipedia - Chi distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class Chi : IContinuousDistribution
{
System.Random _random;
@ -53,23 +49,23 @@ namespace MathNet.Numerics.Distributions
double _freedom;
/// <summary>
/// Initializes a new instance of the <see cref="Chi"/> class.
/// Initializes a new instance of the <see cref="Chi"/> class.
/// </summary>
/// <param name="freedom">The degrees of freedom (k) of the distribution. Range: k > 0.</param>
public Chi(double freedom)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(freedom);
}
/// <summary>
/// Initializes a new instance of the <see cref="Chi"/> class.
/// Initializes a new instance of the <see cref="Chi"/> class.
/// </summary>
/// <param name="freedom">The degrees of freedom (k) of the distribution. Range: k > 0.</param>
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
public Chi(double freedom, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(freedom);
}
@ -112,7 +108,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

16
src/Numerics/Distributions/ChiSquared.cs

@ -31,6 +31,7 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
@ -39,11 +40,6 @@ namespace MathNet.Numerics.Distributions
/// This distribution is a sum of the squares of k independent standard normal random variables.
/// <a href="http://en.wikipedia.org/wiki/Chi-square_distribution">Wikipedia - ChiSquare distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class ChiSquared : IContinuousDistribution
{
System.Random _random;
@ -51,23 +47,23 @@ namespace MathNet.Numerics.Distributions
double _freedom;
/// <summary>
/// Initializes a new instance of the <see cref="ChiSquared"/> class.
/// Initializes a new instance of the <see cref="ChiSquared"/> class.
/// </summary>
/// <param name="freedom">The degrees of freedom (k) of the distribution. Range: k > 0.</param>
public ChiSquared(double freedom)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(freedom);
}
/// <summary>
/// Initializes a new instance of the <see cref="ChiSquared"/> class.
/// Initializes a new instance of the <see cref="ChiSquared"/> class.
/// </summary>
/// <param name="freedom">The degrees of freedom (k) of the distribution. Range: k > 0.</param>
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
public ChiSquared(double freedom, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(freedom);
}
@ -110,7 +106,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

14
src/Numerics/Distributions/ContinuousUniform.cs

@ -31,19 +31,15 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
/// <summary>
/// Continuous Univariate Uniform distribution.
/// The continuous uniform distribution is a distribution over real numbers. For details about this distribution, see
/// The continuous uniform distribution is a distribution over real numbers. For details about this distribution, see
/// <a href="http://en.wikipedia.org/wiki/Uniform_distribution_%28continuous%29">Wikipedia - Continuous uniform distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can get/set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class ContinuousUniform : IContinuousDistribution
{
System.Random _random;
@ -66,7 +62,7 @@ namespace MathNet.Numerics.Distributions
/// <exception cref="ArgumentException">If the upper bound is smaller than the lower bound.</exception>
public ContinuousUniform(double lower, double upper)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(lower, upper);
}
@ -79,7 +75,7 @@ namespace MathNet.Numerics.Distributions
/// <exception cref="ArgumentException">If the upper bound is smaller than the lower bound.</exception>
public ContinuousUniform(double lower, double upper, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(lower, upper);
}
@ -133,7 +129,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

20
src/Numerics/Distributions/ConwayMaxwellPoisson.cs

@ -31,6 +31,7 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
@ -38,7 +39,7 @@ namespace MathNet.Numerics.Distributions
/// Discrete Univariate Conway-Maxwell-Poisson distribution.
/// <para>The Conway-Maxwell-Poisson distribution is a generalization of the Poisson, Geometric and Bernoulli
/// distributions. It is parameterized by two real numbers "lambda" and "nu". For
/// <list>
/// <list>
/// <item>nu = 0 the distribution reverts to a Geometric distribution</item>
/// <item>nu = 1 the distribution reverts to the Poisson distribution</item>
/// <item>nu -> infinity the distribution converges to a Bernoulli distribution</item>
@ -46,11 +47,6 @@ namespace MathNet.Numerics.Distributions
/// This implementation will cache the value of the normalization constant.
/// <a href="http://en.wikipedia.org/wiki/Conway%E2%80%93Maxwell%E2%80%93Poisson_distribution">Wikipedia - ConwayMaxwellPoisson distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class ConwayMaxwellPoisson : IDiscreteDistribution
{
System.Random _random;
@ -80,25 +76,25 @@ namespace MathNet.Numerics.Distributions
const double Tolerance = 1e-12;
/// <summary>
/// Initializes a new instance of the <see cref="ConwayMaxwellPoisson"/> class.
/// Initializes a new instance of the <see cref="ConwayMaxwellPoisson"/> class.
/// </summary>
/// <param name="lambda">The lambda (λ) parameter. Range: λ > 0.</param>
/// <param name="nu">The rate of decay (ν) parameter. Range: ν ≥ 0.</param>
public ConwayMaxwellPoisson(double lambda, double nu)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(lambda, nu);
}
/// <summary>
/// Initializes a new instance of the <see cref="ConwayMaxwellPoisson"/> class.
/// Initializes a new instance of the <see cref="ConwayMaxwellPoisson"/> class.
/// </summary>
/// <param name="lambda">The lambda (λ) parameter. Range: λ > 0.</param>
/// <param name="nu">The rate of decay (ν) parameter. Range: ν ≥ 0.</param>
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
public ConwayMaxwellPoisson(double lambda, double nu, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(lambda, nu);
}
@ -112,7 +108,7 @@ namespace MathNet.Numerics.Distributions
}
/// <summary>
/// Checks whether the parameters of the distribution are valid.
/// Checks whether the parameters of the distribution are valid.
/// </summary>
/// <param name="lambda">The lambda (λ) parameter. Range: λ > 0.</param>
/// <param name="nu">The rate of decay (ν) parameter. Range: ν ≥ 0.</param>
@ -163,7 +159,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

24
src/Numerics/Distributions/Dirichlet.cs

@ -31,18 +31,14 @@
using System;
using System.Linq;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
/// <summary>
/// Multivariate Dirichlet distribution. For details about this distribution, see
/// Multivariate Dirichlet distribution. For details about this distribution, see
/// <a href="http://en.wikipedia.org/wiki/Dirichlet_distribution">Wikipedia - Dirichlet distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can get/set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class Dirichlet : IDistribution
{
System.Random _random;
@ -56,7 +52,7 @@ namespace MathNet.Numerics.Distributions
/// <param name="alpha">An array with the Dirichlet parameters.</param>
public Dirichlet(double[] alpha)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(alpha);
}
@ -68,12 +64,12 @@ namespace MathNet.Numerics.Distributions
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
public Dirichlet(double[] alpha, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(alpha);
}
/// <summary>
/// Initializes a new instance of the <see cref="Dirichlet"/> class.
/// Initializes a new instance of the <see cref="Dirichlet"/> class.
/// <seealso cref="System.Random"/>random number generator.</summary>
/// <param name="alpha">The value of each parameter of the Dirichlet distribution.</param>
/// <param name="k">The dimension of the Dirichlet distribution.</param>
@ -86,12 +82,12 @@ namespace MathNet.Numerics.Distributions
parm[i] = alpha;
}
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(parm);
}
/// <summary>
/// Initializes a new instance of the <see cref="Dirichlet"/> class.
/// Initializes a new instance of the <see cref="Dirichlet"/> class.
/// <seealso cref="System.Random"/>random number generator.</summary>
/// <param name="alpha">The value of each parameter of the Dirichlet distribution.</param>
/// <param name="k">The dimension of the Dirichlet distribution.</param>
@ -105,7 +101,7 @@ namespace MathNet.Numerics.Distributions
parm[i] = alpha;
}
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(parm);
}
@ -179,7 +175,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>
@ -251,7 +247,7 @@ namespace MathNet.Numerics.Distributions
/// </summary>
/// <param name="x">The locations at which to compute the density.</param>
/// <returns>the density at <paramref name="x"/>.</returns>
/// <remarks>The Dirichlet distribution requires that the sum of the components of x equals 1.
/// <remarks>The Dirichlet distribution requires that the sum of the components of x equals 1.
/// You can also leave out the last <paramref name="x"/> component, and it will be computed from the others. </remarks>
public double Density(double[] x)
{

14
src/Numerics/Distributions/DiscreteUniform.cs

@ -31,6 +31,7 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
@ -40,11 +41,6 @@ namespace MathNet.Numerics.Distributions
/// is parameterized by a lower and upper bound (both inclusive).
/// <a href="http://en.wikipedia.org/wiki/Uniform_distribution_%28discrete%29">Wikipedia - Discrete uniform distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class DiscreteUniform : IDiscreteDistribution
{
System.Random _random;
@ -59,7 +55,7 @@ namespace MathNet.Numerics.Distributions
/// <param name="upper">Upper bound. Range: lower ≤ upper.</param>
public DiscreteUniform(int lower, int upper)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(lower, upper);
}
@ -71,7 +67,7 @@ namespace MathNet.Numerics.Distributions
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
public DiscreteUniform(int lower, int upper, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(lower, upper);
}
@ -87,7 +83,7 @@ namespace MathNet.Numerics.Distributions
}
/// <summary>
/// Checks whether the parameters of the distribution are valid.
/// Checks whether the parameters of the distribution are valid.
/// </summary>
/// <param name="lower">Lower bound. Range: lower ≤ upper.</param>
/// <param name="upper">Upper bound. Range: lower ≤ upper.</param>
@ -138,7 +134,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

16
src/Numerics/Distributions/Erlang.cs

@ -31,6 +31,7 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
@ -40,11 +41,6 @@ namespace MathNet.Numerics.Distributions
/// relation to the exponential and Gamma distributions.
/// <a href="http://en.wikipedia.org/wiki/Erlang_distribution">Wikipedia - Erlang distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class Erlang : IContinuousDistribution
{
System.Random _random;
@ -53,25 +49,25 @@ namespace MathNet.Numerics.Distributions
double _rate;
/// <summary>
/// Initializes a new instance of the <see cref="Erlang"/> class.
/// Initializes a new instance of the <see cref="Erlang"/> class.
/// </summary>
/// <param name="shape">The shape (k) of the Erlang distribution. Range: k ≥ 0.</param>
/// <param name="rate">The rate or inverse scale (λ) of the Erlang distribution. Range: λ ≥ 0.</param>
public Erlang(int shape, double rate)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(shape, rate);
}
/// <summary>
/// Initializes a new instance of the <see cref="Erlang"/> class.
/// Initializes a new instance of the <see cref="Erlang"/> class.
/// </summary>
/// <param name="shape">The shape (k) of the Erlang distribution. Range: k ≥ 0.</param>
/// <param name="rate">The rate or inverse scale (λ) of the Erlang distribution. Range: λ ≥ 0.</param>
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
public Erlang(int shape, double rate, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(shape, rate);
}
@ -166,7 +162,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

12
src/Numerics/Distributions/Exponential.cs

@ -31,6 +31,7 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
@ -39,11 +40,6 @@ namespace MathNet.Numerics.Distributions
/// The exponential distribution is a distribution over the real numbers parameterized by one non-negative parameter.
/// <a href="http://en.wikipedia.org/wiki/Exponential_distribution">Wikipedia - exponential distribution</a>.
/// </summary>
/// <remarks>The distribution will use the <see cref="System.Random"/> by default.
/// <para>Users can set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class Exponential : IContinuousDistribution
{
System.Random _random;
@ -56,7 +52,7 @@ namespace MathNet.Numerics.Distributions
/// <param name="rate">The rate (λ) parameter of the distribution. Range: λ ≥ 0.</param>
public Exponential(double rate)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(rate);
}
@ -67,7 +63,7 @@ namespace MathNet.Numerics.Distributions
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
public Exponential(double rate, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(rate);
}
@ -110,7 +106,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

18
src/Numerics/Distributions/FisherSnedecor.cs

@ -31,19 +31,15 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
/// <summary>
/// Continuous Univariate F-distribution, also known as Fisher-Snedecor distribution.
/// For details about this distribution, see
/// For details about this distribution, see
/// <a href="http://en.wikipedia.org/wiki/F-distribution">Wikipedia - FisherSnedecor distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class FisherSnedecor : IContinuousDistribution
{
System.Random _random;
@ -52,25 +48,25 @@ namespace MathNet.Numerics.Distributions
double _freedom2;
/// <summary>
/// Initializes a new instance of the <see cref="FisherSnedecor"/> class.
/// Initializes a new instance of the <see cref="FisherSnedecor"/> class.
/// </summary>
/// <param name="d1">The first degree of freedom (d1) of the distribution. Range: d1 > 0.</param>
/// <param name="d2">The second degree of freedom (d2) of the distribution. Range: d2 > 0.</param>
public FisherSnedecor(double d1, double d2)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(d1, d2);
}
/// <summary>
/// Initializes a new instance of the <see cref="FisherSnedecor"/> class.
/// Initializes a new instance of the <see cref="FisherSnedecor"/> class.
/// </summary>
/// <param name="d1">The first degree of freedom (d1) of the distribution. Range: d1 > 0.</param>
/// <param name="d2">The second degree of freedom (d2) of the distribution. Range: d2 > 0.</param>
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
public FisherSnedecor(double d1, double d2, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(d1, d2);
}
@ -124,7 +120,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

52
src/Numerics/Distributions/Gamma.cs

@ -31,27 +31,25 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
/// <summary>
/// Continuous Univariate Gamma distribution.
/// For details about this distribution, see
/// For details about this distribution, see
/// <a href="http://en.wikipedia.org/wiki/Gamma_distribution">Wikipedia - Gamma distribution</a>.
/// </summary>
/// <remarks>
/// <para>The Gamma distribution is parametrized by a shape and inverse scale parameter. When we want
/// The Gamma distribution is parametrized by a shape and inverse scale parameter. When we want
/// to specify a Gamma distribution which is a point distribution we set the shape parameter to be the
/// location of the point distribution and the inverse scale as positive infinity. The distribution
/// with shape and inverse scale both zero is undefined.</para>
/// <para> Random number generation for the Gamma distribution is based on the algorithm in:
/// with shape and inverse scale both zero is undefined.
///
/// Random number generation for the Gamma distribution is based on the algorithm in:
/// "A Simple Method for Generating Gamma Variables" - Marsaglia &amp; Tsang
/// ACM Transactions on Mathematical Software, Vol. 26, No. 3, September 2000, Pages 363–372.</para>
/// <para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can get/set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
/// ACM Transactions on Mathematical Software, Vol. 26, No. 3, September 2000, Pages 363–372.
/// </remarks>
public class Gamma : IContinuousDistribution
{
System.Random _random;
@ -66,7 +64,7 @@ namespace MathNet.Numerics.Distributions
/// <param name="rate">The rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.</param>
public Gamma(double shape, double rate)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(shape, rate);
}
@ -78,7 +76,7 @@ namespace MathNet.Numerics.Distributions
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
public Gamma(double shape, double rate, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(shape, rate);
}
@ -173,7 +171,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>
@ -359,6 +357,18 @@ namespace MathNet.Numerics.Distributions
return CDF(_shape, _rate, x);
}
/// <summary>
/// Computes the inverse of the cumulative distribution function (InvCDF) for the distribution
/// at the given probability. This is also known as the quantile or percent point function.
/// </summary>
/// <param name="p">The location at which to compute the inverse cumulative density.</param>
/// <returns>the inverse cumulative density at <paramref name="p"/>.</returns>
/// <seealso cref="InvCDF"/>
public double InverseCumulativeDistribution(double p)
{
return InvCDF(_shape, _rate, p);
}
/// <summary>
/// Generates a sample from the Gamma distribution.
/// </summary>
@ -490,6 +500,22 @@ namespace MathNet.Numerics.Distributions
return SpecialFunctions.GammaLowerRegularized(shape, x*rate);
}
/// <summary>
/// Computes the inverse of the cumulative distribution function (InvCDF) for the distribution
/// at the given probability. This is also known as the quantile or percent point function.
/// </summary>
/// <param name="p">The location at which to compute the inverse cumulative density.</param>
/// <param name="shape">The shape (k, α) of the Gamma distribution. Range: α ≥ 0.</param>
/// <param name="rate">The rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.</param>
/// <returns>the inverse cumulative density at <paramref name="p"/>.</returns>
/// <seealso cref="InverseCumulativeDistribution"/>
public static double InvCDF(double shape, double rate, double p)
{
if (shape < 0.0 || rate < 0.0) throw new ArgumentOutOfRangeException(Resources.InvalidDistributionParameters);
return SpecialFunctions.GammaLowerRegularizedInv(shape, p)/rate;
}
/// <summary>
/// Generates a sample from the Gamma distribution.
/// </summary>

14
src/Numerics/Distributions/Geometric.cs

@ -31,6 +31,7 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
@ -40,11 +41,6 @@ namespace MathNet.Numerics.Distributions
/// This implementation of the Geometric distribution will never generate 0's.
/// <a href="http://en.wikipedia.org/wiki/Geometric_distribution">Wikipedia - geometric distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class Geometric : IDiscreteDistribution
{
System.Random _random;
@ -57,7 +53,7 @@ namespace MathNet.Numerics.Distributions
/// <param name="p">The probability (p) of generating one. Range: 0 ≤ p ≤ 1.</param>
public Geometric(double p)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(p);
}
@ -68,7 +64,7 @@ namespace MathNet.Numerics.Distributions
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
public Geometric(double p, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(p);
}
@ -82,7 +78,7 @@ namespace MathNet.Numerics.Distributions
}
/// <summary>
/// Checks whether the parameters of the distribution are valid.
/// Checks whether the parameters of the distribution are valid.
/// </summary>
/// <param name="p">The probability (p) of generating one. Range: 0 ≤ p ≤ 1.</param>
/// <returns><c>true</c> when the parameters are valid, <c>false</c> otherwise.</returns>
@ -121,7 +117,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

17
src/Numerics/Distributions/Hypergeometric.cs

@ -31,22 +31,17 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
/// <summary>
/// Discrete Univariate Hypergeometric distribution.
/// This distribution is a discrete probability distribution that describes the number of successes in a sequence
/// of n draws from a finite population without replacement, just as the binomial distribution
/// This distribution is a discrete probability distribution that describes the number of successes in a sequence
/// of n draws from a finite population without replacement, just as the binomial distribution
/// describes the number of successes for draws with replacement
/// <a href="http://en.wikipedia.org/wiki/Hypergeometric_distribution">Wikipedia - Hypergeometric distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can set the random number generator by using the <see cref="RandomSource"/> property</para>.
/// <para>
/// The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class Hypergeometric : IDiscreteDistribution
{
System.Random _random;
@ -63,7 +58,7 @@ namespace MathNet.Numerics.Distributions
/// <param name="draws">The number of draws without replacement (n).</param>
public Hypergeometric(int population, int success, int draws)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(population, success, draws);
}
@ -76,7 +71,7 @@ namespace MathNet.Numerics.Distributions
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
public Hypergeometric(int population, int success, int draws, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(population, success, draws);
}
@ -128,7 +123,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

16
src/Numerics/Distributions/InverseGamma.cs

@ -32,6 +32,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
@ -41,11 +42,6 @@ namespace MathNet.Numerics.Distributions
/// two positive parameters.
/// <a href="http://en.wikipedia.org/wiki/Inverse-gamma_distribution">Wikipedia - InverseGamma distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class InverseGamma : IContinuousDistribution
{
System.Random _random;
@ -54,25 +50,25 @@ namespace MathNet.Numerics.Distributions
double _scale;
/// <summary>
/// Initializes a new instance of the <see cref="InverseGamma"/> class.
/// Initializes a new instance of the <see cref="InverseGamma"/> class.
/// </summary>
/// <param name="shape">The shape (α) of the distribution. Range: α > 0.</param>
/// <param name="scale">The scale (β) of the distribution. Range: β > 0.</param>
public InverseGamma(double shape, double scale)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(shape, scale);
}
/// <summary>
/// Initializes a new instance of the <see cref="InverseGamma"/> class.
/// Initializes a new instance of the <see cref="InverseGamma"/> class.
/// </summary>
/// <param name="shape">The shape (α) of the distribution. Range: α > 0.</param>
/// <param name="scale">The scale (β) of the distribution. Range: β > 0.</param>
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
public InverseGamma(double shape, double scale, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(shape, scale);
}
@ -126,7 +122,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

34
src/Numerics/Distributions/InverseWishart.cs

@ -32,6 +32,7 @@ using System;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Factorization;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
@ -41,11 +42,6 @@ namespace MathNet.Numerics.Distributions
/// is the conjugate prior for the covariance matrix of a multivariate normal distribution.
/// <a href="http://en.wikipedia.org/wiki/Inverse-Wishart_distribution">Wikipedia - Inverse-Wishart distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class InverseWishart : IDistribution
{
System.Random _random;
@ -59,25 +55,25 @@ namespace MathNet.Numerics.Distributions
Cholesky<double> _chol;
/// <summary>
/// Initializes a new instance of the <see cref="InverseWishart"/> class.
/// Initializes a new instance of the <see cref="InverseWishart"/> class.
/// </summary>
/// <param name="degreesOfFreedom">The degree of freedom (ν) for the inverse Wishart distribution.</param>
/// <param name="scale">The scale matrix (Ψ) for the inverse Wishart distribution.</param>
public InverseWishart(double degreesOfFreedom, Matrix<double> scale)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(degreesOfFreedom, scale);
}
/// <summary>
/// Initializes a new instance of the <see cref="InverseWishart"/> class.
/// Initializes a new instance of the <see cref="InverseWishart"/> class.
/// </summary>
/// <param name="degreesOfFreedom">The degree of freedom (ν) for the inverse Wishart distribution.</param>
/// <param name="scale">The scale matrix (Ψ) for the inverse Wishart distribution.</param>
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
public InverseWishart(double degreesOfFreedom, Matrix<double> scale, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(degreesOfFreedom, scale);
}
@ -91,7 +87,7 @@ namespace MathNet.Numerics.Distributions
}
/// <summary>
/// Checks whether the parameters of the distribution are valid.
/// Checks whether the parameters of the distribution are valid.
/// </summary>
/// <param name="degreesOfFreedom">The degree of freedom (ν) for the inverse Wishart distribution.</param>
/// <param name="scale">The scale matrix (Ψ) for the inverse Wishart distribution.</param>
@ -156,7 +152,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>
@ -187,18 +183,12 @@ namespace MathNet.Numerics.Distributions
{
get
{
var res = _scale.CreateMatrix(_scale.RowCount, _scale.ColumnCount);
for (var i = 0; i < res.RowCount; i++)
return Matrix<double>.Build.Dense(_scale.RowCount, _scale.ColumnCount, (i, j) =>
{
for (var j = 0; j < res.ColumnCount; j++)
{
var num1 = ((_freedom - _scale.RowCount + 1)*_scale.At(i, j)*_scale.At(i, j)) + ((_freedom - _scale.RowCount - 1)*_scale.At(i, i)*_scale.At(j, j));
var num2 = (_freedom - _scale.RowCount)*(_freedom - _scale.RowCount - 1)*(_freedom - _scale.RowCount - 1)*(_freedom - _scale.RowCount - 3);
res.At(i, j, num1/num2);
}
}
return res;
var num1 = ((_freedom - _scale.RowCount + 1)*_scale.At(i, j)*_scale.At(i, j)) + ((_freedom - _scale.RowCount - 1)*_scale.At(i, i)*_scale.At(j, j));
var num2 = (_freedom - _scale.RowCount)*(_freedom - _scale.RowCount - 1)*(_freedom - _scale.RowCount - 1)*(_freedom - _scale.RowCount - 3);
return num1/num2;
});
}
}

18
src/Numerics/Distributions/Laplace.cs

@ -31,6 +31,7 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
@ -41,11 +42,6 @@ namespace MathNet.Numerics.Distributions
/// p(x) = \frac{1}{2 * scale} \exp{- |x - mean| / scale}.
/// <a href="http://en.wikipedia.org/wiki/Laplace_distribution">Wikipedia - Laplace distribution</a>.
/// </summary>
/// <remarks>The distribution will use the <see cref="System.Random"/> by default.
/// <para>Users can set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class Laplace : IContinuousDistribution
{
System.Random _random;
@ -54,7 +50,7 @@ namespace MathNet.Numerics.Distributions
double _scale;
/// <summary>
/// Initializes a new instance of the <see cref="Laplace"/> class (location = 0, scale = 1).
/// Initializes a new instance of the <see cref="Laplace"/> class (location = 0, scale = 1).
/// </summary>
public Laplace()
: this(0.0, 1.0)
@ -62,19 +58,19 @@ namespace MathNet.Numerics.Distributions
}
/// <summary>
/// Initializes a new instance of the <see cref="Laplace"/> class.
/// Initializes a new instance of the <see cref="Laplace"/> class.
/// </summary>
/// <param name="location">The location (μ) of the distribution.</param>
/// <param name="scale">The scale (b) of the distribution. Range: b > 0.</param>
/// <exception cref="ArgumentException">If <paramref name="scale"/> is negative.</exception>
public Laplace(double location, double scale)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(location, scale);
}
/// <summary>
/// Initializes a new instance of the <see cref="Laplace"/> class.
/// Initializes a new instance of the <see cref="Laplace"/> class.
/// </summary>
/// <param name="location">The location (μ) of the distribution.</param>
/// <param name="scale">The scale (b) of the distribution. Range: b > 0.</param>
@ -82,7 +78,7 @@ namespace MathNet.Numerics.Distributions
/// <exception cref="ArgumentException">If <paramref name="scale"/> is negative.</exception>
public Laplace(double location, double scale, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(location, scale);
}
@ -136,7 +132,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

18
src/Numerics/Distributions/LogNormal.cs

@ -32,20 +32,16 @@ using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Statistics;
namespace MathNet.Numerics.Distributions
{
/// <summary>
/// Continuous Univariate Log-Normal distribution.
/// For details about this distribution, see
/// For details about this distribution, see
/// <a href="http://en.wikipedia.org/wiki/Log-normal_distribution">Wikipedia - Log-Normal distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can get/set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class LogNormal : IContinuousDistribution
{
System.Random _random;
@ -54,7 +50,7 @@ namespace MathNet.Numerics.Distributions
double _sigma;
/// <summary>
/// Initializes a new instance of the <see cref="LogNormal"/> class.
/// Initializes a new instance of the <see cref="LogNormal"/> class.
/// The distribution will be initialized with the default <seealso cref="System.Random"/>
/// random number generator.
/// </summary>
@ -62,12 +58,12 @@ namespace MathNet.Numerics.Distributions
/// <param name="sigma">The shape (σ) of the logarithm of the distribution. Range: σ ≥ 0.</param>
public LogNormal(double mu, double sigma)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(mu, sigma);
}
/// <summary>
/// Initializes a new instance of the <see cref="LogNormal"/> class.
/// Initializes a new instance of the <see cref="LogNormal"/> class.
/// The distribution will be initialized with the default <seealso cref="System.Random"/>
/// random number generator.
/// </summary>
@ -76,7 +72,7 @@ namespace MathNet.Numerics.Distributions
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
public LogNormal(double mu, double sigma, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(mu, sigma);
}
@ -168,7 +164,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

22
src/Numerics/Distributions/MatrixNormal.cs

@ -32,6 +32,7 @@ using System;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
@ -41,17 +42,12 @@ namespace MathNet.Numerics.Distributions
/// for the columns (K). If the dimension of M is d-by-m then V is d-by-d and K is m-by-m.
/// <a href="http://en.wikipedia.org/wiki/Matrix_normal_distribution">Wikipedia - MatrixNormal distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class MatrixNormal : IDistribution
{
System.Random _random;
/// <summary>
/// The mean of the matrix normal distribution.
/// The mean of the matrix normal distribution.
/// </summary>
Matrix<double> _m;
@ -66,7 +62,7 @@ namespace MathNet.Numerics.Distributions
Matrix<double> _k;
/// <summary>
/// Initializes a new instance of the <see cref="MatrixNormal"/> class.
/// Initializes a new instance of the <see cref="MatrixNormal"/> class.
/// </summary>
/// <param name="m">The mean of the matrix normal.</param>
/// <param name="v">The covariance matrix for the rows.</param>
@ -74,12 +70,12 @@ namespace MathNet.Numerics.Distributions
/// <exception cref="ArgumentOutOfRangeException">If the dimensions of the mean and two covariance matrices don't match.</exception>
public MatrixNormal(Matrix<double> m, Matrix<double> v, Matrix<double> k)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(m, v, k);
}
/// <summary>
/// Initializes a new instance of the <see cref="MatrixNormal"/> class.
/// Initializes a new instance of the <see cref="MatrixNormal"/> class.
/// </summary>
/// <param name="m">The mean of the matrix normal.</param>
/// <param name="v">The covariance matrix for the rows.</param>
@ -88,7 +84,7 @@ namespace MathNet.Numerics.Distributions
/// <exception cref="ArgumentOutOfRangeException">If the dimensions of the mean and two covariance matrices don't match.</exception>
public MatrixNormal(Matrix<double> m, Matrix<double> v, Matrix<double> k, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(m, v, k);
}
@ -104,7 +100,7 @@ namespace MathNet.Numerics.Distributions
}
/// <summary>
/// Checks whether the parameters of the distribution are valid.
/// Checks whether the parameters of the distribution are valid.
/// </summary>
/// <param name="m">The mean of the matrix normal.</param>
/// <param name="v">The covariance matrix for the rows.</param>
@ -198,7 +194,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>
@ -283,7 +279,7 @@ namespace MathNet.Numerics.Distributions
var chol = covariance.Cholesky();
// Sample a standard normal variable.
var v = DenseVector.CreateRandom(mean.Count, new Normal(rnd));
var v = Vector<double>.Build.Random(mean.Count, new Normal(rnd));
// Return the transformed variable.
return mean + (chol.Factor*v);

42
src/Numerics/Distributions/Multinomial.cs

@ -34,22 +34,20 @@ using System.Linq;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Statistics;
namespace MathNet.Numerics.Distributions
{
/// <summary>
/// Multivariate Multinomial distribution. For details about this distribution, see
/// Multivariate Multinomial distribution. For details about this distribution, see
/// <a href="http://en.wikipedia.org/wiki/Multinomial_distribution">Wikipedia - Multinomial distribution</a>.
/// </summary>
/// <remarks><para>The distribution is parameterized by a vector of ratios: in other words, the parameter
/// <remarks>
/// The distribution is parameterized by a vector of ratios: in other words, the parameter
/// does not have to be normalized and sum to 1. The reason is that some vectors can't be exactly normalized
/// to sum to 1 in floating point representation.</para>
/// <para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
/// to sum to 1 in floating point representation.
/// </remarks>
public class Multinomial : IDistribution
{
System.Random _random;
@ -67,21 +65,21 @@ namespace MathNet.Numerics.Distributions
/// <summary>
/// Initializes a new instance of the Multinomial class.
/// </summary>
/// <param name="p">An array of nonnegative ratios: this array does not need to be normalized
/// <param name="p">An array of nonnegative ratios: this array does not need to be normalized
/// as this is often impossible using floating point arithmetic.</param>
/// <param name="n">The number of trials.</param>
/// <exception cref="ArgumentOutOfRangeException">If any of the probabilities are negative or do not sum to one.</exception>
/// <exception cref="ArgumentOutOfRangeException">If <paramref name="n"/> is negative.</exception>
public Multinomial(double[] p, int n)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(p, n);
}
/// <summary>
/// Initializes a new instance of the Multinomial class.
/// </summary>
/// <param name="p">An array of nonnegative ratios: this array does not need to be normalized
/// <param name="p">An array of nonnegative ratios: this array does not need to be normalized
/// as this is often impossible using floating point arithmetic.</param>
/// <param name="n">The number of trials.</param>
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
@ -89,7 +87,7 @@ namespace MathNet.Numerics.Distributions
/// <exception cref="ArgumentOutOfRangeException">If <paramref name="n"/> is negative.</exception>
public Multinomial(double[] p, int n, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(p, n);
}
@ -118,7 +116,7 @@ namespace MathNet.Numerics.Distributions
}
SetParameters(p, n);
RandomSource = new System.Random(Random.RandomSeed.Guid());
RandomSource = SystemRandomSource.Default;
}
/// <summary>
@ -131,12 +129,12 @@ namespace MathNet.Numerics.Distributions
}
/// <summary>
/// Checks whether the parameters of the distribution are valid.
/// Checks whether the parameters of the distribution are valid.
/// </summary>
/// <param name="p">An array of nonnegative ratios: this array does not need to be normalized
/// <param name="p">An array of nonnegative ratios: this array does not need to be normalized
/// as this is often impossible using floating point arithmetic.</param>
/// <param name="n">The number of trials.</param>
/// <returns>If any of the probabilities are negative returns <c>false</c>,
/// <returns>If any of the probabilities are negative returns <c>false</c>,
/// if the sum of parameters is 0.0, or if the number of trials is negative; otherwise <c>true</c>.</returns>
static bool IsValidParameterSet(IEnumerable<double> p, int n)
{
@ -162,7 +160,7 @@ namespace MathNet.Numerics.Distributions
/// <summary>
/// Sets the parameters of the distribution after checking their validity.
/// </summary>
/// <param name="p">An array of nonnegative ratios: this array does not need to be normalized
/// <param name="p">An array of nonnegative ratios: this array does not need to be normalized
/// as this is often impossible using floating point arithmetic.</param>
/// <param name="n">The number of trials.</param>
/// <exception cref="ArgumentOutOfRangeException">When the parameters are out of range.</exception>
@ -201,7 +199,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>
@ -219,7 +217,7 @@ namespace MathNet.Numerics.Distributions
{
get
{
// Do not use _p, because operations below will modify _p array. Use P or _p.Clone().
// Do not use _p, because operations below will modify _p array. Use P or _p.Clone().
var res = (DenseVector) P;
for (var i = 0; i < res.Count; i++)
{
@ -237,7 +235,7 @@ namespace MathNet.Numerics.Distributions
{
get
{
// Do not use _p, because operations below will modify _p array. Use P or _p.Clone().
// Do not use _p, because operations below will modify _p array. Use P or _p.Clone().
var res = (DenseVector) P;
for (var i = 0; i < res.Count; i++)
{
@ -336,7 +334,7 @@ namespace MathNet.Numerics.Distributions
/// Samples one multinomial distributed random variable.
/// </summary>
/// <param name="rnd">The random number generator to use.</param>
/// <param name="p">An array of nonnegative ratios: this array does not need to be normalized
/// <param name="p">An array of nonnegative ratios: this array does not need to be normalized
/// as this is often impossible using floating point arithmetic.</param>
/// <param name="n">The number of trials.</param>
/// <returns>the counts for each of the different possible values.</returns>
@ -365,7 +363,7 @@ namespace MathNet.Numerics.Distributions
/// Samples a multinomially distributed random variable.
/// </summary>
/// <param name="rnd">The random number generator to use.</param>
/// <param name="p">An array of nonnegative ratios: this array does not need to be normalized
/// <param name="p">An array of nonnegative ratios: this array does not need to be normalized
/// as this is often impossible using floating point arithmetic.</param>
/// <param name="n">The number of variables needed.</param>
/// <returns>a sequence of counts for each of the different possible values.</returns>

20
src/Numerics/Distributions/NegativeBinomial.cs

@ -31,6 +31,7 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
@ -41,11 +42,6 @@ namespace MathNet.Numerics.Distributions
/// when the probability of head is p.
/// <a href="http://en.wikipedia.org/wiki/Negative_binomial_distribution">Wikipedia - NegativeBinomial distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class NegativeBinomial : IDiscreteDistribution
{
System.Random _random;
@ -54,25 +50,25 @@ namespace MathNet.Numerics.Distributions
double _p;
/// <summary>
/// Initializes a new instance of the <see cref="NegativeBinomial"/> class.
/// Initializes a new instance of the <see cref="NegativeBinomial"/> class.
/// </summary>
/// <param name="r">The number of failures (r) until the experiment stopped. Range: r ≥ 0.</param>
/// <param name="p">The probability (p) of a trial resulting in success. Range: 0 ≤ p ≤ 1.</param>
public NegativeBinomial(double r, double p)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(r, p);
}
/// <summary>
/// Initializes a new instance of the <see cref="NegativeBinomial"/> class.
/// Initializes a new instance of the <see cref="NegativeBinomial"/> class.
/// </summary>
/// <param name="r">The number of failures (r) until the experiment stopped. Range: r ≥ 0.</param>
/// <param name="p">The probability (p) of a trial resulting in success. Range: 0 ≤ p ≤ 1.</param>
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
public NegativeBinomial(double r, double p, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(r, p);
}
@ -88,11 +84,11 @@ namespace MathNet.Numerics.Distributions
}
/// <summary>
/// Checks whether the parameters of the distribution are valid.
/// Checks whether the parameters of the distribution are valid.
/// </summary>
/// <param name="r">The number of failures (r) until the experiment stopped. Range: r ≥ 0.</param>
/// <param name="p">The probability (p) of a trial resulting in success. Range: 0 ≤ p ≤ 1.</param>
/// <returns><c>true</c> when the parameters are valid, <c>false</c> otherwise.</returns>
/// <returns><c>true</c> when the parameters are valid, <c>false</c> otherwise.</returns>
static bool IsValidParameterSet(double r, double p)
{
return r >= 0.0 && p >= 0.0 && p <= 1.0;
@ -139,7 +135,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>
/// Gets the mean of the distribution.

14
src/Numerics/Distributions/Normal.cs

@ -31,20 +31,16 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Statistics;
namespace MathNet.Numerics.Distributions
{
/// <summary>
/// Continuous Univariate Normal distribution, also known as Gaussian distribution.
/// For details about this distribution, see
/// For details about this distribution, see
/// <a href="http://en.wikipedia.org/wiki/Normal_distribution">Wikipedia - Normal distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can get/set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class Normal : IContinuousDistribution
{
System.Random _random;
@ -81,7 +77,7 @@ namespace MathNet.Numerics.Distributions
/// <param name="stddev">The standard deviation (σ) of the normal distribution. Range: σ ≥ 0.</param>
public Normal(double mean, double stddev)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(mean, stddev);
}
@ -94,7 +90,7 @@ namespace MathNet.Numerics.Distributions
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
public Normal(double mean, double stddev, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(mean, stddev);
}
@ -224,7 +220,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

20
src/Numerics/Distributions/NormalGamma.cs

@ -31,6 +31,7 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
@ -51,7 +52,7 @@ namespace MathNet.Numerics.Distributions
double _precision;
/// <summary>
/// Initializes a new instance of the <see cref="MeanPrecisionPair"/> struct.
/// Initializes a new instance of the <see cref="MeanPrecisionPair"/> struct.
/// </summary>
/// <param name="m">The mean of the pair.</param>
/// <param name="p">The precision of the pair.</param>
@ -95,11 +96,6 @@ namespace MathNet.Numerics.Distributions
/// will be positive infinity. A completely degenerate NormalGamma distribution with known mean and precision is possible as well.</para>
/// <a href="http://en.wikipedia.org/wiki/Normal-gamma_distribution">Wikipedia - Normal-Gamma distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can get/set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class NormalGamma : IDistribution
{
System.Random _random;
@ -110,7 +106,7 @@ namespace MathNet.Numerics.Distributions
double _precisionInvScale;
/// <summary>
/// Initializes a new instance of the <see cref="NormalGamma"/> class.
/// Initializes a new instance of the <see cref="NormalGamma"/> class.
/// </summary>
/// <param name="meanLocation">The location of the mean.</param>
/// <param name="meanScale">The scale of the mean.</param>
@ -118,12 +114,12 @@ namespace MathNet.Numerics.Distributions
/// <param name="precisionInverseScale">The inverse scale of the precision.</param>
public NormalGamma(double meanLocation, double meanScale, double precisionShape, double precisionInverseScale)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(meanLocation, meanScale, precisionShape, precisionInverseScale);
}
/// <summary>
/// Initializes a new instance of the <see cref="NormalGamma"/> class.
/// Initializes a new instance of the <see cref="NormalGamma"/> class.
/// </summary>
/// <param name="meanLocation">The location of the mean.</param>
/// <param name="meanScale">The scale of the mean.</param>
@ -132,7 +128,7 @@ namespace MathNet.Numerics.Distributions
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
public NormalGamma(double meanLocation, double meanScale, double precisionShape, double precisionInverseScale, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(meanLocation, meanScale, precisionShape, precisionInverseScale);
}
@ -147,7 +143,7 @@ namespace MathNet.Numerics.Distributions
}
/// <summary>
/// Checks whether the parameters of the distribution are valid.
/// Checks whether the parameters of the distribution are valid.
/// </summary>
/// <param name="meanLocation">The location of the mean.</param>
/// <param name="meanScale">The scale of the mean.</param>
@ -222,7 +218,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

20
src/Numerics/Distributions/Pareto.cs

@ -31,21 +31,17 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
/// <summary>
/// Continuous Univariate Pareto distribution.
/// The Pareto distribution is a power law probability distribution that coincides with social,
/// The Pareto distribution is a power law probability distribution that coincides with social,
/// scientific, geophysical, actuarial, and many other types of observable phenomena.
/// For details about this distribution, see
/// For details about this distribution, see
/// <a href="http://en.wikipedia.org/wiki/Pareto_distribution">Wikipedia - Pareto distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can get/set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class Pareto : IContinuousDistribution
{
System.Random _random;
@ -54,19 +50,19 @@ namespace MathNet.Numerics.Distributions
double _shape;
/// <summary>
/// Initializes a new instance of the <see cref="Pareto"/> class.
/// Initializes a new instance of the <see cref="Pareto"/> class.
/// </summary>
/// <param name="scale">The scale (xm) of the distribution. Range: xm > 0.</param>
/// <param name="shape">The shape (α) of the distribution. Range: α > 0.</param>
/// <exception cref="ArgumentException">If <paramref name="scale"/> or <paramref name="shape"/> are negative.</exception>
public Pareto(double scale, double shape)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(scale, shape);
}
/// <summary>
/// Initializes a new instance of the <see cref="Pareto"/> class.
/// Initializes a new instance of the <see cref="Pareto"/> class.
/// </summary>
/// <param name="scale">The scale (xm) of the distribution. Range: xm > 0.</param>
/// <param name="shape">The shape (α) of the distribution. Range: α > 0.</param>
@ -74,7 +70,7 @@ namespace MathNet.Numerics.Distributions
/// <exception cref="ArgumentException">If <paramref name="scale"/> or <paramref name="shape"/> are negative.</exception>
public Pareto(double scale, double shape, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(scale, shape);
}
@ -128,7 +124,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

7
src/Numerics/Distributions/Poisson.cs

@ -31,6 +31,7 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
@ -55,7 +56,7 @@ namespace MathNet.Numerics.Distributions
/// <exception cref="System.ArgumentOutOfRangeException">If <paramref name="lambda"/> is equal or less then 0.0.</exception>
public Poisson(double lambda)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(lambda);
}
@ -67,7 +68,7 @@ namespace MathNet.Numerics.Distributions
/// <exception cref="System.ArgumentOutOfRangeException">If <paramref name="lambda"/> is equal or less then 0.0.</exception>
public Poisson(double lambda, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(lambda);
}
@ -122,7 +123,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

22
src/Numerics/Distributions/Rayleigh.cs

@ -31,22 +31,18 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
{
/// <summary>
/// Continuous Univariate Rayleigh distribution.
/// The Rayleigh distribution (pronounced /ˈreɪli/) is a continuous probability distribution. As an
/// example of how it arises, the wind speed will have a Rayleigh distribution if the components of
/// The Rayleigh distribution (pronounced /ˈreɪli/) is a continuous probability distribution. As an
/// example of how it arises, the wind speed will have a Rayleigh distribution if the components of
/// the two-dimensional wind velocity vector are uncorrelated and normally distributed with equal variance.
/// For details about this distribution, see
/// For details about this distribution, see
/// <a href="http://en.wikipedia.org/wiki/Rayleigh_distribution">Wikipedia - Rayleigh distribution</a>.
/// </summary>
/// <remarks><para>The distribution will use the <see cref="System.Random"/> by default.
/// Users can get/set the random number generator by using the <see cref="RandomSource"/> property.</para>
/// <para>The statistics classes will check all the incoming parameters whether they are in the allowed
/// range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters
/// to <c>false</c>, all parameter checks can be turned off.</para></remarks>
public class Rayleigh : IContinuousDistribution
{
System.Random _random;
@ -54,25 +50,25 @@ namespace MathNet.Numerics.Distributions
double _scale;
/// <summary>
/// Initializes a new instance of the <see cref="Rayleigh"/> class.
/// Initializes a new instance of the <see cref="Rayleigh"/> class.
/// </summary>
/// <param name="scale">The scale (σ) of the distribution. Range: σ > 0.</param>
/// <exception cref="ArgumentException">If <paramref name="scale"/> is negative.</exception>
public Rayleigh(double scale)
{
_random = new System.Random(Random.RandomSeed.Guid());
_random = SystemRandomSource.Default;
SetParameters(scale);
}
/// <summary>
/// Initializes a new instance of the <see cref="Rayleigh"/> class.
/// Initializes a new instance of the <see cref="Rayleigh"/> class.
/// </summary>
/// <param name="scale">The scale (σ) of the distribution. Range: σ > 0.</param>
/// <param name="randomSource">The random number generator which is used to draw random samples.</param>
/// <exception cref="ArgumentException">If <paramref name="scale"/> is negative.</exception>
public Rayleigh(double scale, System.Random randomSource)
{
_random = randomSource ?? new System.Random(Random.RandomSeed.Guid());
_random = randomSource ?? SystemRandomSource.Default;
SetParameters(scale);
}
@ -115,7 +111,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
set { _random = value ?? new System.Random(Random.RandomSeed.Guid()); }
set { _random = value ?? SystemRandomSource.Default; }
}
/// <summary>

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save