Browse Source

Build: try migrating to NUnit v3.2 (from v2)

Includes a workaround for a type collision when using NUnit3's .Net 2.0
build on .Net 3.5, see nunit/nunit#1349 for details.

Leverage Paket file-dependencies for FsUnit instead of NuGet packages
since it makes sense and the FsUnit NuGet package no longer supports
.Net 3.5. Partially migrate to FsUnitTypes where possible.

Since every unit test file had to be touched anyway, also fixes file headers
where they were broken.

No longer commit packages folder (.gitignore). Use restore.cmd to restore.
netstandard
Christoph Ruegg 11 years ago
parent
commit
b866a4cb32
  1. 3
      .gitignore
  2. 10
      build.fsx
  3. 1
      packages/.gitattributes
  4. BIN
      packages/FSharp.Core/FSharp.Core.3.1.2.5.nupkg
  5. 30
      packages/FSharp.Core/FSharp.Core.nuspec
  6. 1
      packages/FSharp.Core/[Content_Types].xml
  7. 1
      packages/FSharp.Core/_rels/.rels
  8. BIN
      packages/FSharp.Core/lib/net20/FSharp.Core.dll
  9. BIN
      packages/FSharp.Core/lib/net20/FSharp.Core.optdata
  10. BIN
      packages/FSharp.Core/lib/net20/FSharp.Core.sigdata
  11. 9715
      packages/FSharp.Core/lib/net20/FSharp.Core.xml
  12. BIN
      packages/FSharp.Core/lib/net40/FSharp.Core.dll
  13. BIN
      packages/FSharp.Core/lib/net40/FSharp.Core.optdata
  14. BIN
      packages/FSharp.Core/lib/net40/FSharp.Core.sigdata
  15. 10715
      packages/FSharp.Core/lib/net40/FSharp.Core.xml
  16. BIN
      packages/FSharp.Core/lib/portable-net45+monoandroid10+monotouch10+xamarinios10/FSharp.Core.dll
  17. BIN
      packages/FSharp.Core/lib/portable-net45+monoandroid10+monotouch10+xamarinios10/FSharp.Core.optdata
  18. BIN
      packages/FSharp.Core/lib/portable-net45+monoandroid10+monotouch10+xamarinios10/FSharp.Core.sigdata
  19. 11088
      packages/FSharp.Core/lib/portable-net45+monoandroid10+monotouch10+xamarinios10/FSharp.Core.xml
  20. BIN
      packages/FSharp.Core/lib/portable-net45+netcore45+wp8/FSharp.Core.dll
  21. BIN
      packages/FSharp.Core/lib/portable-net45+netcore45+wp8/FSharp.Core.optdata
  22. BIN
      packages/FSharp.Core/lib/portable-net45+netcore45+wp8/FSharp.Core.sigdata
  23. 10842
      packages/FSharp.Core/lib/portable-net45+netcore45+wp8/FSharp.Core.xml
  24. BIN
      packages/FSharp.Core/lib/portable-net45+netcore45+wpa81+wp8/FSharp.Core.dll
  25. BIN
      packages/FSharp.Core/lib/portable-net45+netcore45+wpa81+wp8/FSharp.Core.optdata
  26. BIN
      packages/FSharp.Core/lib/portable-net45+netcore45+wpa81+wp8/FSharp.Core.sigdata
  27. 10842
      packages/FSharp.Core/lib/portable-net45+netcore45+wpa81+wp8/FSharp.Core.xml
  28. BIN
      packages/FSharp.Core/lib/portable-net45+netcore45/FSharp.Core.dll
  29. BIN
      packages/FSharp.Core/lib/portable-net45+netcore45/FSharp.Core.optdata
  30. BIN
      packages/FSharp.Core/lib/portable-net45+netcore45/FSharp.Core.sigdata
  31. 10653
      packages/FSharp.Core/lib/portable-net45+netcore45/FSharp.Core.xml
  32. BIN
      packages/FSharp.Core/lib/portable-net45+sl5+netcore45/FSharp.Core.dll
  33. BIN
      packages/FSharp.Core/lib/portable-net45+sl5+netcore45/FSharp.Core.optdata
  34. BIN
      packages/FSharp.Core/lib/portable-net45+sl5+netcore45/FSharp.Core.sigdata
  35. 10533
      packages/FSharp.Core/lib/portable-net45+sl5+netcore45/FSharp.Core.xml
  36. 1541
      packages/FSharp.Core/license.html
  37. 14
      packages/FSharp.Core/package/services/metadata/core-properties/8f892edb52054d8cbb6b676af1a01d28.psmdcp
  38. BIN
      packages/TaskParallelLibrary/TaskParallelLibrary.1.0.2856.nupkg
  39. 23
      packages/TaskParallelLibrary/TaskParallelLibrary.nuspec
  40. 1
      packages/TaskParallelLibrary/[Content_Types].xml
  41. 1
      packages/TaskParallelLibrary/_rels/.rels
  42. BIN
      packages/TaskParallelLibrary/lib/Net35/System.Threading.chm
  43. BIN
      packages/TaskParallelLibrary/lib/Net35/System.Threading.dll
  44. 19811
      packages/TaskParallelLibrary/lib/Net35/System.Threading.xml
  45. 11
      packages/TaskParallelLibrary/lib/Net35/redist.txt
  46. 622
      packages/TaskParallelLibrary/license.html
  47. 5
      packages/TaskParallelLibrary/package/services/metadata/core-properties/afb2a006c6df4e3d9c1193b2bb601a42.psmdcp
  48. 8
      paket.dependencies
  49. 22
      paket.lock
  50. 45
      src/DataUnitTests/UnitTests.csproj
  51. 58
      src/FSharpUnitTests/DenseMatrixTests.fs
  52. 28
      src/FSharpUnitTests/DenseVectorTests.fs
  53. 65
      src/FSharpUnitTests/FSharpUnitTests-Net35.fsproj
  54. 4
      src/FSharpUnitTests/FSharpUnitTests-Net35.fsproj.paket.references
  55. 65
      src/FSharpUnitTests/FSharpUnitTests-Portable47.fsproj
  56. 65
      src/FSharpUnitTests/FSharpUnitTests.fsproj
  57. 30
      src/FSharpUnitTests/FindRootsTests.fs
  58. 6
      src/FSharpUnitTests/FitTests.fs
  59. 82
      src/FSharpUnitTests/MatrixTests.fs
  60. 21
      src/FSharpUnitTests/PokerTests.fs
  61. 27
      src/FSharpUnitTests/QuaternionTests.fs
  62. 17
      src/FSharpUnitTests/RandomVariableTests.fs
  63. 45
      src/FSharpUnitTests/SparseMatrixTests.fs
  64. 7
      src/FSharpUnitTests/SparseVectorTests.fs
  65. 2
      src/FSharpUnitTests/Utilities.fs
  66. 64
      src/FSharpUnitTests/VectorTests.fs
  67. 5
      src/FSharpUnitTests/paket.references
  68. 6
      src/UnitTests/ArrayHelpers.cs
  69. 10
      src/UnitTests/AssertHelpers.cs
  70. 11
      src/UnitTests/CombinatoricsTests/CombinatoricsCountingTest.cs
  71. 16
      src/UnitTests/ComplexTests/Complex32Test.TextHandling.cs
  72. 14
      src/UnitTests/ComplexTests/Complex32Test.cs
  73. 10
      src/UnitTests/ComplexTests/ComplexTest.TextHandling.cs
  74. 10
      src/UnitTests/ComplexTests/ComplexTest.cs
  75. 14
      src/UnitTests/DifferentiationTests/FiniteDifferenceCoefficientsTests.cs
  76. 23
      src/UnitTests/DifferentiationTests/NumericalDerivativeTests.cs
  77. 15
      src/UnitTests/DifferentiationTests/NumericalHessianTests.cs
  78. 19
      src/UnitTests/DifferentiationTests/NumericalJacobianTests.cs
  79. 33
      src/UnitTests/DistanceTests.cs
  80. 6
      src/UnitTests/DistributionTests/CommonDistributionTests.cs
  81. 6
      src/UnitTests/DistributionTests/Continuous/BetaScaledTests.cs
  82. 8
      src/UnitTests/DistributionTests/Continuous/BetaTests.cs
  83. 6
      src/UnitTests/DistributionTests/Continuous/CauchyTests.cs
  84. 6
      src/UnitTests/DistributionTests/Continuous/ChiSquareTests.cs
  85. 6
      src/UnitTests/DistributionTests/Continuous/ChiTests.cs
  86. 6
      src/UnitTests/DistributionTests/Continuous/ContinuousUniformTests.cs
  87. 6
      src/UnitTests/DistributionTests/Continuous/ErlangTests.cs
  88. 6
      src/UnitTests/DistributionTests/Continuous/ExponentialTests.cs
  89. 6
      src/UnitTests/DistributionTests/Continuous/FisherSnedecorTests.cs
  90. 6
      src/UnitTests/DistributionTests/Continuous/GammaTests.cs
  91. 6
      src/UnitTests/DistributionTests/Continuous/InverseGammaTests.cs
  92. 6
      src/UnitTests/DistributionTests/Continuous/LaplaceTests.cs
  93. 6
      src/UnitTests/DistributionTests/Continuous/LogNormalTests.cs
  94. 6
      src/UnitTests/DistributionTests/Continuous/NormalTests.cs
  95. 6
      src/UnitTests/DistributionTests/Continuous/ParetoTests.cs
  96. 6
      src/UnitTests/DistributionTests/Continuous/RayleighTests.cs
  97. 6
      src/UnitTests/DistributionTests/Continuous/StableTests.cs
  98. 6
      src/UnitTests/DistributionTests/Continuous/StudentTTests.cs
  99. 14
      src/UnitTests/DistributionTests/Continuous/TriangularTests.cs
  100. 6
      src/UnitTests/DistributionTests/Continuous/WeibullTests.cs

3
.gitignore

@ -62,7 +62,8 @@ packages/*
!packages/FSharp.Core
# FAKE & Paket
packages/FAKE
packages
paket-files
.paket/paket.exe
.fake

10
build.fsx

@ -23,6 +23,7 @@ open Fake.DocuHelper
open Fake.AssemblyInfoFile
open Fake.ReleaseNotesHelper
open Fake.StringHelper
open Fake.Testing.NUnit3
open System
open System.IO
@ -491,12 +492,11 @@ Target "DataBuild" (fun _ -> build !! "MathNet.Numerics.Data.sln")
// --------------------------------------------------------------------------------------
let test target =
let quick p = if hasBuildParam "quick" then { p with ExcludeCategory="LongRunning" } else p
NUnit (fun p ->
let quick p = if hasBuildParam "quick" then { p with Where="!~LongRunning" } else p
NUnit3 (fun p ->
{ p with
DisableShadowCopy = true
TimeOut = TimeSpan.FromMinutes 60.
OutputFile = "TestResults.xml" } |> quick) target
ShadowCopy = false
TimeOut = TimeSpan.FromMinutes 60. } |> quick) target
Target "Test" (fun _ -> test !! "out/test/**/*UnitTests*.dll")
"Build" ?=> "Test"

1
packages/.gitattributes

@ -1 +0,0 @@
* -text

BIN
packages/FSharp.Core/FSharp.Core.3.1.2.5.nupkg

Binary file not shown.

30
packages/FSharp.Core/FSharp.Core.nuspec

@ -1,30 +0,0 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>FSharp.Core</id>
<version>3.1.2.5</version>
<title>FSharp.Core for F# 3.1</title>
<authors>F# Software Foundation</authors>
<owners>F# Software Foundation</owners>
<licenseUrl>https://github.com/fsharp/fsharp/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/fsharp/fsharp</projectUrl>
<iconUrl>http://fsharp.org/img/logo.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>FSharp.Core for F# 3.1
FSharp.Core redistributables from Visual F# 3.1.2
.NET 2.0
.NET 4.0
.NET Portable Profile 7 (portable-net45+netcore45)
.NET Portable Profile 47 (portable-net45+sl5+netcore45)
.NET Portable Profile 78 (portable-net45+netcore45+wp8)
.NET Portable Profile 259 (portable-net45+netcore45+wpa81+wp8)
FSharp.Core built by F# Software Foundation
MonoAndroid, MonoTouch, Xamarin.iOS (portable-net45+monoandroid10+monotouch10+xamarinios10)</description>
<summary>FSharp.Core for F# 3.1</summary>
<tags>F#, FSharp, FSharp.Core</tags>
</metadata>
</package>

1
packages/FSharp.Core/[Content_Types].xml

@ -1 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" /><Default Extension="nuspec" ContentType="application/octet" /><Default Extension="dll" ContentType="application/octet" /><Default Extension="optdata" ContentType="application/octet" /><Default Extension="sigdata" ContentType="application/octet" /><Default Extension="xml" ContentType="application/octet" /><Default Extension="psmdcp" ContentType="application/vnd.openxmlformats-package.core-properties+xml" /></Types>

1
packages/FSharp.Core/_rels/.rels

@ -1 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Type="http://schemas.microsoft.com/packaging/2010/07/manifest" Target="/FSharp.Core.nuspec" Id="R515164d0c2e74e41" /><Relationship Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="/package/services/metadata/core-properties/8f892edb52054d8cbb6b676af1a01d28.psmdcp" Id="R2bdfc51ac78f4e7e" /></Relationships>

BIN
packages/FSharp.Core/lib/net20/FSharp.Core.dll

Binary file not shown.

BIN
packages/FSharp.Core/lib/net20/FSharp.Core.optdata

Binary file not shown.

BIN
packages/FSharp.Core/lib/net20/FSharp.Core.sigdata

Binary file not shown.

9715
packages/FSharp.Core/lib/net20/FSharp.Core.xml

File diff suppressed because it is too large

BIN
packages/FSharp.Core/lib/net40/FSharp.Core.dll

Binary file not shown.

BIN
packages/FSharp.Core/lib/net40/FSharp.Core.optdata

Binary file not shown.

BIN
packages/FSharp.Core/lib/net40/FSharp.Core.sigdata

Binary file not shown.

10715
packages/FSharp.Core/lib/net40/FSharp.Core.xml

File diff suppressed because it is too large

BIN
packages/FSharp.Core/lib/portable-net45+monoandroid10+monotouch10+xamarinios10/FSharp.Core.dll

Binary file not shown.

BIN
packages/FSharp.Core/lib/portable-net45+monoandroid10+monotouch10+xamarinios10/FSharp.Core.optdata

Binary file not shown.

BIN
packages/FSharp.Core/lib/portable-net45+monoandroid10+monotouch10+xamarinios10/FSharp.Core.sigdata

Binary file not shown.

11088
packages/FSharp.Core/lib/portable-net45+monoandroid10+monotouch10+xamarinios10/FSharp.Core.xml

File diff suppressed because it is too large

BIN
packages/FSharp.Core/lib/portable-net45+netcore45+wp8/FSharp.Core.dll

Binary file not shown.

BIN
packages/FSharp.Core/lib/portable-net45+netcore45+wp8/FSharp.Core.optdata

Binary file not shown.

BIN
packages/FSharp.Core/lib/portable-net45+netcore45+wp8/FSharp.Core.sigdata

Binary file not shown.

10842
packages/FSharp.Core/lib/portable-net45+netcore45+wp8/FSharp.Core.xml

File diff suppressed because it is too large

BIN
packages/FSharp.Core/lib/portable-net45+netcore45+wpa81+wp8/FSharp.Core.dll

Binary file not shown.

BIN
packages/FSharp.Core/lib/portable-net45+netcore45+wpa81+wp8/FSharp.Core.optdata

Binary file not shown.

BIN
packages/FSharp.Core/lib/portable-net45+netcore45+wpa81+wp8/FSharp.Core.sigdata

Binary file not shown.

10842
packages/FSharp.Core/lib/portable-net45+netcore45+wpa81+wp8/FSharp.Core.xml

File diff suppressed because it is too large

BIN
packages/FSharp.Core/lib/portable-net45+netcore45/FSharp.Core.dll

Binary file not shown.

BIN
packages/FSharp.Core/lib/portable-net45+netcore45/FSharp.Core.optdata

Binary file not shown.

BIN
packages/FSharp.Core/lib/portable-net45+netcore45/FSharp.Core.sigdata

Binary file not shown.

10653
packages/FSharp.Core/lib/portable-net45+netcore45/FSharp.Core.xml

File diff suppressed because it is too large

BIN
packages/FSharp.Core/lib/portable-net45+sl5+netcore45/FSharp.Core.dll

Binary file not shown.

BIN
packages/FSharp.Core/lib/portable-net45+sl5+netcore45/FSharp.Core.optdata

Binary file not shown.

BIN
packages/FSharp.Core/lib/portable-net45+sl5+netcore45/FSharp.Core.sigdata

Binary file not shown.

10533
packages/FSharp.Core/lib/portable-net45+sl5+netcore45/FSharp.Core.xml

File diff suppressed because it is too large

1541
packages/FSharp.Core/license.html

File diff suppressed because it is too large

14
packages/FSharp.Core/package/services/metadata/core-properties/8f892edb52054d8cbb6b676af1a01d28.psmdcp

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><coreProperties xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"><dc:creator>F# Software Foundation</dc:creator><dc:description>FSharp.Core for F# 3.1
FSharp.Core redistributables from Visual F# 3.1.2
.NET 2.0
.NET 4.0
.NET Portable Profile 7 (portable-net45+netcore45)
.NET Portable Profile 47 (portable-net45+sl5+netcore45)
.NET Portable Profile 78 (portable-net45+netcore45+wp8)
.NET Portable Profile 259 (portable-net45+netcore45+wpa81+wp8)
FSharp.Core built by F# Software Foundation
MonoAndroid, MonoTouch, Xamarin.iOS (portable-net45+monoandroid10+monotouch10+xamarinios10)</dc:description><dc:identifier>FSharp.Core</dc:identifier><version>3.1.2.5</version><keywords>F#, FSharp, FSharp.Core</keywords><dc:title>FSharp.Core for F# 3.1</dc:title></coreProperties>

BIN
packages/TaskParallelLibrary/TaskParallelLibrary.1.0.2856.nupkg

Binary file not shown.

23
packages/TaskParallelLibrary/TaskParallelLibrary.nuspec

@ -1,23 +0,0 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<version>1.0.2856.0</version>
<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>
<id>TaskParallelLibrary</id>
<title>Task Parallel Library for .NET 3.5</title>
<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>
<language>en-us</language>
<tags>tpl plinq pfx task parallel extensions .net35 backport</tags>
</metadata>
</package>

1
packages/TaskParallelLibrary/[Content_Types].xml

@ -1 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" /><Default Extension="nuspec" ContentType="application/octet" /><Default Extension="txt" ContentType="application/octet" /><Default Extension="chm" ContentType="application/octet" /><Default Extension="dll" ContentType="application/octet" /><Default Extension="xml" ContentType="application/octet" /><Default Extension="psmdcp" ContentType="application/vnd.openxmlformats-package.core-properties+xml" /></Types>

1
packages/TaskParallelLibrary/_rels/.rels

@ -1 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Type="http://schemas.microsoft.com/packaging/2010/07/manifest" Target="/TaskParallelLibrary.nuspec" Id="R751913bcaa504e71" /><Relationship Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="/package/services/metadata/core-properties/afb2a006c6df4e3d9c1193b2bb601a42.psmdcp" Id="R73e7a03e7b564c19" /></Relationships>

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

Binary file not shown.

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

Binary file not shown.

19811
packages/TaskParallelLibrary/lib/Net35/System.Threading.xml

File diff suppressed because it is too large

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

@ -1,11 +0,0 @@
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

622
packages/TaskParallelLibrary/license.html

@ -1,622 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="search.content.shortId" content="hh295787" />
<meta name="ms.shortidmsdn" content="hh295787" />
<meta name="search.content.locale" content="en-us" />
<meta name="MN" content="FB361396-10:18:02 AM" />
<meta http-equiv="content-language" content="en" />
<link rel="canonical" href="https://msdn.microsoft.com/en-us/hh295787.aspx" />
<meta name="NormalizedUrl" content="https://msdn.microsoft.com/en-us/hh295787(d=default,l=en-us,v=MSDN.10).aspx" />
<meta name="ms.normalizedurl" content="https://msdn.microsoft.com/en-us/hh295787(d=default,l=en-us,v=MSDN.10).aspx" />
<meta name="Title" content="Reactive Extensions Eula" />
<meta name="Search.MSCategory" content="bb447661" />
<meta name="Search.TocNodeId" content="bb447661" />
<meta name="ROBOTS" content="NOINDEX,NOFOLLOW" />
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js" data-do-not-move="true" data-provides="jQuery"></script>
<script type="text/javascript" src="https://i2-msdn.sec.s-msft.com/Areas/Sto/Content/Scripts/jquery.partial.js" data-do-not-move="true" data-requires="jQuery" data-provides="jQuery.partial"></script>
<script type="text/javascript" data-do-not-move="true">
//<![CDATA[
window.appInsightsId = '60854590-027a-4ae4-98be-2741a40f355f';
//]]>
</script>
<title>Reactive Extensions Eula</title>
<link rel="stylesheet" type="text/css" href="https://i-msdn.sec.s-msft.com/Combined.css?resources=0:Teaser,0:Search,0:LocaleSelector,1:tabstrip,0:Footer,0:RatingsOnly,0:NetReflector,0:CorporatePromoSpot,0:Default,1:Default,2:Default,3:Header,3:HeaderFooterSprite,3:Header.Static,4:LinkList,3:Footer,3:Footer.Static,4:FooterSock;/Areas/Sto/Content/Theming:0,/Areas/Sto/Content/Theming/office_metro:1,/Areas/Sto/Content/Theming/office_metro/msdn_metro_library:2,/Areas/Centers/Themes/StandardDevCenter/Content:3,/Areas/Epx/Themes/Base/Content:4&amp;amp;v=D98A8186FAE2F9E21E0C3050FFE733E2" /></head>
<body id="MTPS_Body" class="MsdnPageBody">
<div id="BodyBackground">
<link type="text/css" rel="stylesheet" />
<input type="hidden" id="isHeaderBleeding" value="true" />
<div id="ux-header" dir="ltr" class="ltr msdn">
<header>
<span id="singleCol"></span>
<span id="doubleCol"></span>
<span id="isMobile"></span>
<div>
<div class="row topRow">
<div class="top">
<div class="left">
<a class="msdnLogoImg" href="https://msdn.microsoft.com/en-us" title="MSDN home">
<div id="msft-logo" class="msft-logo"></div>
</a>
<div class="GrayPipe"></div>
<a class="DevCenterFullNameNonMegaBlade" href="https://msdn.microsoft.com/en-us">Developer Network</a>
<a class="DevCenterFullName" href="https://msdn.microsoft.com/en-us">Developer Network</a>
<a class="DevCenterShortName" href="https://msdn.microsoft.com/en-us">Developer</a>
</div>
<div class="right">
<div id="signIn">
<img class="profileImage" src="https://i-msdn.sec.s-msft.com/Areas/Centers/Themes/StandardDevCenter/Content/Images/profile.jpg?v=635786533159225463" />
<a class="scarabLink" href="https://login.live.com/login.srf?wa=wsignin1.0&amp;rpsnv=12&amp;ct=1443892684&amp;rver=6.0.5276.0&amp;wp=MCMBI&amp;wlcxt=msdn$msdn$msdn&amp;wreply=https://msdn.microsoft.com/en-us/hh295787&amp;lc=1033&amp;id=254354&amp;mkt=en-US" title="Sign in">Sign in</a></div>
<div class="auxNav">
<div>
<div data-fragmentName="Subscriptions" id="Fragment_Subscriptions" xmlns="http://www.w3.org/1999/xhtml">
<a href="https://msdn.microsoft.com/subscriptions/manage/hh442900" id="Subscriptions_2153_1" xmlns="http://www.w3.org/1999/xhtml">MSDN subscriptions</a>
</div>
<div data-fragmentName="GetTools" id="Fragment_GetTools" xmlns="http://www.w3.org/1999/xhtml">
<a href="http://go.microsoft.com/fwlink/?LinkId=309297&amp;clcid=0x409&amp;slcid=0x409&amp;campaign=o~msft~msdn~gettools-header~dn308572" id="GetTools_2153_3" xmlns="http://www.w3.org/1999/xhtml">Get tools</a>
</div>
</div>
<div>
<div data-fragmentName="SocialLinks" id="Fragment_SocialLinks" xmlns="http://www.w3.org/1999/xhtml">
<div class="linkList">
<ul class="links horizontal">
<li>
<a href="http://www.facebook.com/microsoftdeveloper" target="_blank" id="SocialLinks_2152_4" class="facebook" xmlns="http://www.w3.org/1999/xhtml">http://www.facebook.com/microsoftdeveloper</a>
</li>
<li>
<a href="https://twitter.com/msdev" target="_blank" id="SocialLinks_2152_5" class="twitter" xmlns="http://www.w3.org/1999/xhtml">https://twitter.com/msdev</a>
</li>
<li>
<a href="http://plus.google.com/111221966647232053570/" target="_blank" id="SocialLinks_2152_6" class="googlePlus" xmlns="http://www.w3.org/1999/xhtml">http://plus.google.com/111221966647232053570/</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row middleRow">
<div class="expandTop">
<div class="left"></div>
<div class="right"></div>
</div>
</div>
</div>
<div id="buttomRowWrapper" class="bg_default">
<div class="row buttomRow bg_default">
<div class="bottom">
<div class="left">
<a id="grip" class="menu-icon" href="javascript:void(0)"></a>
<div id="drawer">
<div class="toc">
<nav>
<ul class="navL1">
<li class="inactive toggle">
<a href="javascript:void(0)" title="Technologies">Technologies</a>
<ul class="navL2">
<li class="inactive">
<a href="https://msdn.microsoft.com/cloud-app-development-msdn" title="Cloud">Cloud</a>
</li>
<li class="inactive">
<a href="https://msdn.microsoft.com/app-development-msdn" title="App Development">App Development</a>
</li>
<li class="inactive">
<a href="https://msdn.microsoft.com/web-app-development-msdn" title="Web">Web</a>
</li>
<li class="inactive">
<a href="https://msdn.microsoft.com/big-data-development-msdn" title="Data">Data</a>
</li>
<li class="inactive">
<a href="https://msdn.microsoft.com/games-development-msdn" title="Gaming">Gaming</a>
</li>
</ul>
</li>
<li class="inactive toggle">
<a href="javascript:void(0)" title="Downloads">Downloads</a>
<ul class="navL2">
<li class="inactive">
<a href="https://www.visualstudio.com/downloads/download-visual-studio-vs" title="Visual Studio">Visual Studio</a>
</li>
<li class="inactive">
<a href="https://msdn.microsoft.com/subscriptions" title="MSDN subscription access">MSDN subscription access</a>
</li>
<li class="inactive">
<a href="https://msdn.microsoft.com/microsoft-sdks-msdn" title="SDKs">SDKs</a>
</li>
<li class="inactive toggle">
<a href="javascript:void(0)" title="Trial software">Trial software</a>
<ul class="navL3">
<li class="inactive">
<a href="https://msdn.microsoft.com/evalcenter" title="Free downloads">Free downloads</a>
</li>
<li class="inactive">
<a href="https://msdn.microsoft.com/officeevaluationresources" title="Office resources">Office resources</a>
</li>
<li class="inactive">
<a href="https://msdn.microsoft.com/sharepoint2013resources" title="SharePoint Server 2013 resources">SharePoint Server 2013 resources</a>
</li>
<li class="inactive">
<a href="https://msdn.microsoft.com/sqlserver2014expressresources" title="SQL Server 2014 Express resources">SQL Server 2014 Express resources</a>
</li>
<li class="inactive">
<a href="https://msdn.microsoft.com/windowsserver2012r2resources" title="Windows Server 2012 resources">Windows Server 2012 resources</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="inactive toggle">
<a href="javascript:void(0)" title="Programs">Programs</a>
<ul class="navL2">
<li class="inactive">
<a href="https://rewards.msdn.microsoft.com/" title="Rewards">Rewards</a>
</li>
<li class="inactive">
<a href="https://www.microsoft.com/bizspark" title="Startups">Startups</a>
</li>
<li class="inactive toggle">
<a href="javascript:void(0)" title="Students">Students</a>
<ul class="navL3">
<li class="inactive">
<a href="https://msdn.microsoft.com/imagine/imagine-home" title="Microsoft Imagine">Microsoft Imagine</a>
</li>
<li class="inactive">
<a href="https://msdn.microsoft.com/microsoftstudentpartners" title="Microsoft Student Partners">Microsoft Student Partners</a>
</li>
</ul>
</li>
<li class="inactive toggle">
<a href="javascript:void(0)" title="Architects">Architects</a>
<ul class="navL3">
<li class="inactive">
<a href="https://msdn.microsoft.com/architects-overview-msdn" title="Overview">Overview</a>
</li>
<li class="inactive">
<a href="https://msdn.microsoft.com/architects-case-studies-msdn" title="Case studies">Case studies</a>
</li>
<li class="inactive">
<a href="https://msdn.microsoft.com/architects-blueprints-msdn" title="Blueprints">Blueprints</a>
</li>
<li class="inactive">
<a href="http://blogs.msdn.com/b/msarchitecture/" title="Blog">Blog</a>
</li>
<li class="inactive">
<a href="http://social.msdn.microsoft.com/forums/en-us/home?brandignore=true&amp;sort=relevancedesc&amp;searchterm=architecture+or+architect" title="Forums">Forums</a>
</li>
</ul>
</li>
<li class="inactive">
<a href="http://events.msdn.microsoft.com/" title="Events">Events</a>
</li>
<li class="inactive toggle">
<a href="javascript:void(0)" title="MSDN Subscriptions">MSDN Subscriptions</a>
<ul class="navL3">
<li class="inactive">
<a href="https://msdn.microsoft.com/msdn-subscriptions-overview" title="Overview">Overview</a>
</li>
<li class="inactive">
<a href="https://msdn.microsoft.com/benefits-overview" title="Benefits">Benefits</a>
</li>
<li class="inactive">
<a href="https://msdn.microsoft.com/msdn-subscriptions-administration" title="Administrators">Administrators</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="inactive toggle">
<a href="javascript:void(0)" title="Community">Community</a>
<ul class="navL2">
<li class="inactive">
<a href="https://msdn.microsoft.com/magazine/dd767791" title="Magazine">Magazine</a>
</li>
<li class="inactive">
<a href="https://social.msdn.microsoft.com/forums/" title="Forums">Forums</a>
</li>
<li class="inactive">
<a href="http://blogs.msdn.com/b/developer-tools/" title="Blogs">Blogs</a>
</li>
<li class="inactive">
<a href="http://tech-advisors.msdn.microsoft.com/en-us" title="Tech Advisors">Tech Advisors</a>
</li>
<li class="inactive">
<a href="http://channel9.msdn.com/" title="Channel 9">Channel 9</a>
</li>
</ul>
</li>
<li class="inactive toggle">
<a href="javascript:void(0)" title="Documentation">Documentation</a>
<ul class="navL2">
<li class="inactive">
<a href="https://msdn.microsoft.com/library" title="APIs and reference">APIs and reference</a>
</li>
<li class="inactive">
<a href="https://msdn.microsoft.com/developer-centers-msdn" title="Dev centers">Dev centers</a>
</li>
</ul>
</li>
<li class="inactive">
<a href="https://code.msdn.microsoft.com/" title="Samples">Samples</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="right">
<div data-fragmentName="SearchBox" id="Fragment_SearchBox" xmlns="http://www.w3.org/1999/xhtml">
<div class="SearchBox">
<form id="HeaderSearchForm" name="HeaderSearchForm" method="get">
<button id="FakeHeaderSearchButton" value="Search" type="submit" class="header-search-button">
<div id="search-finder" class="search-finder"></div>
</button>
<button id="HeaderSearchButton" style="display:none"></button>
<div id="searchSplitter"></div>
<div id="searchCloseIcon" class="search-clear-x"></div>
<div id="searchTextContainer" style="width: 0;">
<input id="HeaderSearchTextBox" name="query" type="text" maxlength="200" onfocus="Epx.Controls.SearchBox.watermarkFocus(event, this.title)" onblur="Epx.Controls.SearchBox.watermarkBlur(event, this.title)" />
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</header>
</div>
<div id="JelloSizer">
<div id="JelloExpander">
<div id="JelloWrapper">
<div class="Clear"> </div>
<div class="topleftcorner"> </div>
<div class="toprightcorner"> </div>
<div class="alley">
<div class="wrapper">
<div class="inner">
<div class="Clear"> </div>
<div class="BreadCrumb"><div class="BreadCrumbInner EyebrowContainer"><span class="EyebrowElement">Reactive Extensions Eula</span>
</div></div>
<a name="MainContent"></a>
<div class="FullWidth"><p><strong>To download the file you must agree to the following license:</strong></p><p><strong>MICROSOFT SOFTWARE LICENSE TERMS</strong></p><p><strong>MICROSOFT REACTIVE EXTENSIONS FOR JAVASCRIPT AND .NET LIBRARIES</strong></p><hr /><p>These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft</p><ul><li>updates,</li><li>supplements,</li><li>Internet-based services, and</li><li>support services</li></ul><p>for this software, unless other terms accompany those items. If so, those terms apply.</p><p><strong>BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.</strong></p><hr /><p><strong>If you comply with these license terms, you have the rights below.</strong></p><ol><li><strong>INSTALLATION AND USE RIGHTS.</strong> You may install and use any number of copies of the software on your devices to design, develop and test your programs. </li><li><strong>ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.</strong><ol style="list-style-type:lower-alpha;"><li><strong>Distributable Code.</strong>The software contains code that you are permitted to distribute in programs you develop if you comply with the terms below. <ol style="list-style-type:lower-roman;"><li><strong>Right to Use and Distribute. The code and text files listed in the software REDIST.TXT files are "Distributable Code."</strong><ul style="list-style-type:square;"><li>
<a href="https://msdn.microsoft.com/en-us/hh881823.aspx">
REDIST.TXT Files</a>. You may copy and distribute the object code form of the Distributable Code. You may also combine the object code form of the Distributable Code with your programs to develop a unified web solution and permit others via online methods to access and use that unified web solution, provided that the Distributable Code is only used as part of and in conjunction with your programs.</li><li><span style="text-decoration:underline;">Third Party Distribution</span>. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.</li></ul></li><li><strong>Distributable Code Requirements. For any Distributable Code, you must</strong><ul style="list-style-type:square;"><li>add significant primary functionality to it in your programs;</li><li>require distributors and external end users to agree to terms that protect it at least as much as this agreement;</li><li>display your valid copyright notice on your programs; and</li><li>indemnify, defend, and hold harmless Microsoft from any claims, including attorneys’ fees, related to the distribution or use of your programs.</li></ul></li><li><strong>Distributable Code Restrictions. You may not</strong><ul style="list-style-type:square;"><li>alter any copyright, trademark or patent notice in the Distributable Code;</li><li>use Microsoft’s trademarks in your programs’ names or in a way that suggests your programs come from or are endorsed by Microsoft;</li><li>include Distributable Code in malicious, deceptive or unlawful programs; or</li><li>modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that <ul style="list-style-type:square;"><li>the code be disclosed or distributed in source code form; or</li><li>others have the right to modify it.</li></ul></li></ul></li></ol></li></ol></li><li style="margin-top:-15px;"><strong>SCOPE OF LICENSE.</strong> The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not<ul style="list-style-type:circle;"><li>work around any technical limitations in the software;</li><li>reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;</li><li>make more copies of the software than specified in this agreement or allowed by applicable law, despite this limitation;</li><li>publish the software for others to copy;</li><li>rent, lease or lend the software; or</li><li>transfer the software or this agreement to any third party.</li></ul></li><li><strong>BACKUP COPY.</strong> You may make one backup copy of the software. You may use it only to reinstall the software.</li><li><strong>DOCUMENTATION.</strong> Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.</li><li><strong>EXPORT RESTRICTIONS.</strong> The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see
<a href="https://www.microsoft.com/exporting">
www.microsoft.com/exporting</a>.</li><li><strong>SUPPORT SERVICES.</strong> Because this software is “as is,” we may not provide support services for it.</li><li><strong>ENTIRE AGREEMENT.</strong> This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.</li><li><strong>APPLICABLE LAW.</strong><ol style="list-style-type: lower-latin;"><li><strong>United States.</strong> If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.</li><li><strong>Outside the United States.</strong> If you acquired the software in any other country, the laws of that country apply.</li></ol></li><li><strong>LEGAL EFFECT.</strong> This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.</li><li><strong>DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS-IS.” YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.</strong></li><li><strong>LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.</strong></li></ol><p style="padding-left: 30px;">This limitation applies to</p><ul style="padding-left: 40px;"><li>anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and</li><li>claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.</li></ul><p style="padding-left: 30px;">It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.</p><p align="center"><button onClick="location.href='http://msdn.microsoft.com/data/gg577609'" style="font-family: 'Segoe UI', Tahoma, Arial" type="button">I disagree</button></p></div>
<div id="footerAd" style="margin-left:auto;margin-right:auto;display:table">
<div><p></p></div>
</div>
</div>
</div>
</div>
<div class="ClearBottom"> </div>
<div class="bottomleftcorner"> </div>
<div class="bottomrightcorner"> </div>
</div>
</div>
</div>
<link type="text/css" rel="stylesheet" />
<div id="ux-footer" class="" style="" dir="ltr">
<div id="footerSock" class="">
<div id="footerSockInner">
<a name="feedback"></a>
<div class="rating">
<div id="ratingSection1">
<div class="title">
Was this page helpful?
</div>
<div class="description">
Your feedback about this content is important.<br />Let us know what you think.
</div>
<div class="buttons">
<button class="button" id="ratingYes" aria-label="Yes, this page was helpful">Yes</button>
<button class="button" id="ratingNo" aria-label="No, this page was not helpful">No</button>
</div>
<input id="ratingValue" type="hidden" value="" />
</div>
<div id="ratingSection2">
<div class="title">
Additional feedback?
</div>
<textarea id="ratingText" rows="6" cols="" maxlength="1500"></textarea>
<div class="counter right">
<span id="feedbackTextCounter">1500</span> characters remaining
</div>
<div class="buttons left">
<button class="button" id="ratingSubmit" aria-label="Submit my additional feedback">Submit</button>
<button class="button" id="ratingSkipThis" aria-label="Skip additional feedback">Skip this</button>
</div>
</div>
<div id="ratingSection3">
<div class="title">
Thank you!
</div>
<div class="description">
We appreciate your feedback.
</div>
</div>
<div id="contentFeedbackQAContainer" style="display: none;"></div>
</div>
<div class="clear"></div>
</div>
</div>
<footer class="top">
<div data-fragmentName="LeftLinks" id="Fragment_LeftLinks" xmlns="http://www.w3.org/1999/xhtml">
<div class="linkList">
<div class="linkListTitle">Dev centers</div>
<ul class="links">
<li>
<a href="https://dev.windows.com" id="LeftLinks_2148_1" class="windowsBlue" xmlns="http://www.w3.org/1999/xhtml">Windows</a>
</li>
<li>
<a href="http://dev.office.com" id="LeftLinks_2148_3" class="office" xmlns="http://www.w3.org/1999/xhtml">Office</a>
</li>
<li>
<a href="https://msdn.microsoft.com/vstudio" id="LeftLinks_2148_4" class="visualStudio" xmlns="http://www.w3.org/1999/xhtml">Visual Studio</a>
</li>
<li>
<a href="http://azure.microsoft.com/en-us/documentation/" target="_blank" id="LeftLinks_2148_12" xmlns="http://www.w3.org/1999/xhtml">Microsoft Azure</a>
</li>
<li>
<a href="https://msdn.microsoft.com/aa937802" id="LeftLinks_2148_5" xmlns="http://www.w3.org/1999/xhtml">More...</a>
</li>
</ul>
</div>
</div>
<div id="rightLinks">
<div data-fragmentName="CenterLinks1" id="Fragment_CenterLinks1" xmlns="http://www.w3.org/1999/xhtml">
<div class="linkList">
<div class="linkListTitle">Learning resources</div>
<ul class="links">
<li>
<a href="http://www.microsoftvirtualacademy.com/" id="CenterLinks1_2151_4" xmlns="http://www.w3.org/1999/xhtml">Microsoft Virtual Academy</a>
</li>
<li>
<a href="http://channel9.msdn.com/" id="CenterLinks1_2151_5" xmlns="http://www.w3.org/1999/xhtml">Channel 9</a>
</li>
<li>
<a href="http://www.interoperabilitybridges.com/" id="CenterLinks1_2151_6" xmlns="http://www.w3.org/1999/xhtml">Interoperability Bridges</a>
</li>
<li>
<a href="https://msdn.microsoft.com/magazine/" id="CenterLinks1_2151_7" xmlns="http://www.w3.org/1999/xhtml">MSDN Magazine</a>
</li>
</ul>
</div>
</div>
<div data-fragmentName="CenterLinks2" id="Fragment_CenterLinks2" xmlns="http://www.w3.org/1999/xhtml">
<div class="linkList">
<div class="linkListTitle">Community</div>
<ul class="links">
<li>
<a href="https://social.msdn.microsoft.com/forums/en-us/home" id="CenterLinks2_2151_8" xmlns="http://www.w3.org/1999/xhtml">Forums</a>
</li>
<li>
<a href="http://blogs.msdn.com/b/developer-tools/" id="CenterLinks2_2151_9" xmlns="http://www.w3.org/1999/xhtml">Blogs</a>
</li>
<li>
<a href="http://www.codeplex.com" id="CenterLinks2_2151_10" xmlns="http://www.w3.org/1999/xhtml">Codeplex</a>
</li>
</ul>
</div>
</div>
<div data-fragmentName="CenterLinks3" id="Fragment_CenterLinks3" xmlns="http://www.w3.org/1999/xhtml">
<div class="linkList">
<div class="linkListTitle">Support</div>
<ul class="links">
<li>
<a href="https://msdn.microsoft.com/hh361695" id="CenterLinks3_2151_11" xmlns="http://www.w3.org/1999/xhtml">Self support</a>
</li>
</ul>
</div>
</div>
<div data-fragmentName="CenterLinks4" id="Fragment_CenterLinks4" xmlns="http://www.w3.org/1999/xhtml">
<div class="linkList">
<div class="linkListTitle">Programs</div>
<ul class="links">
<li>
<a href="https://www.microsoft.com/bizspark/" id="CenterLinks4_2151_13" xmlns="http://www.w3.org/1999/xhtml">BizSpark (for startups)</a>
</li>
<li>
<a href="https://www.dreamspark.com/" id="CenterLinks4_2151_14" xmlns="http://www.w3.org/1999/xhtml">DreamSpark</a>
</li>
<li>
<a href="http://www.imaginecup.com" id="CenterLinks4_2151_17" xmlns="http://www.w3.org/1999/xhtml">Imagine Cup</a>
</li>
</ul>
</div>
</div>
</div>
</footer>
<footer class="bottom">
<span class="localeContainer">
<form class="selectLocale" id="selectLocaleForm" action="https://msdn.microsoft.com/en-us/selectlocale-dmc">
<input type="hidden" name="fromPage" value="http%3a%2f%2fmsdn.microsoft.com%2fen-us%2fhh295787" />
<a href="#" onclick="$('#selectLocaleForm').submit();return false;" title="Change your language">United States (English)</a>
</form>
</span>
<div data-fragmentName="BottomLinks" id="Fragment_BottomLinks" xmlns="http://www.w3.org/1999/xhtml">
<div class="linkList">
<ul class="links horizontal">
<li>
<a href="https://msdn.microsoft.com/newsletter.aspx" id="BottomLinks_2148_7" xmlns="http://www.w3.org/1999/xhtml">Newsletter</a>
</li>
<li>
<a href="https://msdn.microsoft.com/dn529288" id="BottomLinks_2148_8" xmlns="http://www.w3.org/1999/xhtml">Privacy &amp; cookies</a>
</li>
<li>
<a href="https://msdn.microsoft.com/cc300389" id="BottomLinks_2148_9" xmlns="http://www.w3.org/1999/xhtml">Terms of use</a>
</li>
<li>
<a href="https://www.microsoft.com/en-us/legal/intellectualproperty/Trademarks/EN-US.aspx" id="BottomLinks_2148_10" xmlns="http://www.w3.org/1999/xhtml">Trademarks</a>
</li>
</ul>
</div>
</div>
<span class="logoLegal">
<span class="logo"></span>
<span class="copyright">© 2015 Microsoft</span>
</span>
</footer>
</div>
</div>
<noscript>
<img alt="DCSIMG" width="1" height="1" src="http://m.webtrends.com/dcsmgru7m99k7mqmgrhudo0k8_8c6m/njs.gif?dcsuri=/nojavascript&amp;WT.js=No" />
</noscript>
<script type="text/JavaScript" data-do-not-move="true">
//<![CDATA[
var varAutoFirePV = 1;
var varClickTracking = 1;
var varCustomerTracking = 1;
var route = "";
var ctrl = "";
document.write("<script type='text/javascript' src='" + (window.location.protocol) + "//c.microsoft.com/ms.js'" + "><\/script>");
//]]>
</script>
<script type="text/javascript" class="mtps-injected">
/*<![CDATA[*/
(function(window,document){"use strict";function preload(scripts){for(var result=[],script,e,i=0;i<scripts.length;i++)script=scripts[i],script.hasOwnProperty("url")&&(e=document.createElement("script"),e.src=script.url,script.throwaway=e),result.push(script);return result}function inject(scripts,index){var script,elem;if(index>=scripts.length){delete mtps.injectScripts;return}script=scripts[index];elem=document.createElement("script");elem.className="mtps-injected";elem.async=!1;var isLoaded=!1,timeoutId=0,injectNextFnName="",injectNext=elem.onerror=function(){isLoaded||(isLoaded=!0,inject(scripts,index+1),window.clearTimeout(timeoutId),elem.onload=elem.onerror=elem.onreadystatechange=null,injectNextFnName&&delete mtps[injectNextFnName],elem.removeEventListener&&elem.removeEventListener("load",injectNext,!1))};elem.addEventListener?elem.addEventListener("load",injectNext,!1):elem.readyState==="uninitialized"?elem.onreadystatechange=function(){(this.readyState==="loaded"||this.readyState==="complete")&&injectNext()}:elem.onload=injectNext;script.hasOwnProperty("url")?(timeoutId=window.setTimeout(injectNext,12e4),elem.src=script.url):(injectNextFnName="_injectNextScript_"+index,mtps[injectNextFnName]=injectNext,timeoutId=window.setTimeout(injectNext,2e3),elem.text="try {\n"+script.txt+"\n} finally { MTPS."+injectNextFnName+" && MTPS."+injectNextFnName+"(); }");parent.appendChild(elem)}var mtps=window.MTPS||(window.MTPS={}),parent=document.getElementsByTagName("head")[0];mtps.injectScripts=function(scripts){inject(preload(scripts),0)}})(window,document);
MTPS.injectScripts([
{ txt: "/**/\r\n(window.MTPS || (window.MTPS = {})).cdnDomains || (window.MTPS.cdnDomains = { \r\n\t\"image\": \"https://i-msdn.sec.s-msft.com\", \r\n\t\"js\": \"https://i2-msdn.sec.s-msft.com\", \r\n\t\"css\": \"https://i-msdn.sec.s-msft.com\", \r\n\t\"xap\": \"https://msdn.microsoft.com\"\r\n});\r\n/**/" },
{ url: "https://i2-msdn.sec.s-msft.com/Combined.js?resources=0:jquery.cookie,1:Layout,2:Header,2:Footer,3:Utilities,1:Rating,3:AppInsightsPerf,1:SearchBox;/Areas/Sto/Content/Scripts:0,/Areas/Epx/Themes/Base/Content:1,/Areas/Centers/Themes/StandardDevCenter/Content:2,/Areas/Epx/Content/Scripts:3\u0026amp;hashKey=3CD85A9F6EF6C702670363624E0D4477\u0026amp;v=CE86700F37CF4D6BA52ACA6CEA120D55" },
{ url: "https://i1.services.social.microsoft.com/search/Widgets/SearchBox.jss?boxid=HeaderSearchTextBox\u0026btnid=HeaderSearchButton\u0026pgArea=header\u0026brand=Msdn\u0026loc=en-us\u0026focusOnInit=false\u0026emptyWatermark=true\u0026searchButtonTooltip=Search MSDN" },
{ txt: "/**/\n \n var wt_nvr_ru = \"WT_NVR_RU\";\n var wt_fpcdom = \".microsoft.com\";\n var wt_domlist = \"msdn.microsoft.com\";\n var wt_pathlist = \"\";var wt_paramlist = \"DCSext.mtps_devcenter\";\n var wt_siteid = \"MSDN\";\n var gDomain=\"m.webtrends.com\";\n var gDcsId = \"dcsmgru7m99k7mqmgrhudo0k8_8c6m\";\n var gFpc = \"WT_FPC\";\n if (document.cookie.indexOf(gFpc + \"=\") == -1) {\n var scriptElem = document.createElement(\u0027script\u0027);\n scriptElem.src = \"http\" + (window.location.protocol.indexOf(\u0027https:\u0027) == 0 ? \u0027s\u0027 : \u0027\u0027) + \"://\" + gDomain + \"/\" + gDcsId + \"/wtid.js\";\n document.getElementsByTagName(\u0027head\u0027)[0].appendChild(scriptElem);\n }\n var detectedLocale = \"en-us\";\n var wtsp = \"_msdn_\";\n var gTrackEvents = \"1\";\n /**/" },
{ url: "https://i2-msdn.sec.s-msft.com/Areas/Sto/Content/Scripts/webtrendsscript.js" },
{ url: "https://www.microsoft.com/library/svy/sto/https/broker.js" }
]);
/*]]>*/
</script></body>
<![CDATA[
Third party scripts and code linked to or referenced from this website are licensed to you by the parties that own such code, not by Microsoft. See ASP.NET Ajax CDN Terms of Use – http://www.asp.net/ajaxlibrary/CDN.ashx.
]]>
</html>

5
packages/TaskParallelLibrary/package/services/metadata/core-properties/afb2a006c6df4e3d9c1193b2bb601a42.psmdcp

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><coreProperties xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"><dc:creator>Microsoft Corporation</dc:creator><dc: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.</dc:description><dc:identifier>TaskParallelLibrary</dc:identifier><version>1.0.2856.0</version><dc:language>en-us</dc:language><keywords>tpl plinq pfx task parallel extensions .net35 backport</keywords></coreProperties>

8
paket.dependencies

@ -2,16 +2,18 @@ source http://www.nuget.org/api/v2
nuget FSharp.Core ~> 3.1.2
nuget TaskParallelLibrary 1.0.2856
github fsprojects/FsUnit src/FsUnit.NUnit/FsUnit.fs
github fsprojects/FsUnit src/FsUnit.NUnit/FsUnitTyped.fs
group Test
source http://www.nuget.org/api/v2
nuget FSharp.Core
nuget NUnit ~> 2.6
nuget FsUnit ~> 1.3.1
nuget NUnit ~> 3.0
group Build
source http://www.nuget.org/api/v2
nuget FAKE ~> 4.1
nuget NUnit.Runners ~> 2.6
nuget NUnit.Runners ~> 3.0
nuget FSharp.Formatting !~> 2.4
nuget NuGet.CommandLine

22
paket.lock

@ -3,7 +3,11 @@ NUGET
specs:
FSharp.Core (3.1.2.5)
TaskParallelLibrary (1.0.2856)
GITHUB
remote: fsprojects/FsUnit
specs:
src/FsUnit.NUnit/FsUnit.fs (db5644485efee6a228fe3d3f85903a3524b5f32c)
src/FsUnit.NUnit/FsUnitTyped.fs (db5644485efee6a228fe3d3f85903a3524b5f32c)
GROUP Benchmark
NUGET
remote: http://www.nuget.org/api/v2
@ -23,7 +27,17 @@ NUGET
FSharpVSPowerTools.Core (2.3.0)
FSharp.Compiler.Service (>= 2.0.0.3)
NuGet.CommandLine (3.3.0)
NUnit.Runners (2.6.4)
NUnit.ConsoleRunner (3.2.0)
NUnit.Extension.NUnitProjectLoader (3.2.0)
NUnit.Extension.NUnitV2Driver (3.2.0)
NUnit.Extension.NUnitV2ResultWriter (3.2.0)
NUnit.Extension.VSProjectLoader (3.2.0)
NUnit.Runners (3.2.0)
NUnit.ConsoleRunner (3.2.0)
NUnit.Extension.NUnitProjectLoader (3.2.0)
NUnit.Extension.NUnitV2Driver (3.2.0)
NUnit.Extension.NUnitV2ResultWriter (3.2.0)
NUnit.Extension.VSProjectLoader (3.2.0)
GROUP Data
NUGET
@ -36,6 +50,4 @@ NUGET
remote: http://www.nuget.org/api/v2
specs:
FSharp.Core (4.0.0.1)
FsUnit (1.3.1)
NUnit (2.6.4)
NUnit (2.6.4)
NUnit (3.2.0)

45
src/DataUnitTests/UnitTests.csproj

@ -114,11 +114,42 @@
</ItemGroup>
</When>
</Choose>
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v3.0' Or $(TargetFrameworkVersion) == 'v3.5')">
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\net20\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0')">
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\net40\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1')">
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == 'WindowsPhoneApp') Or ($(TargetFrameworkIdentifier) == '.NETCore') Or ($(TargetFrameworkIdentifier) == 'WindowsPhone' And ($(TargetFrameworkVersion) == 'v8.0' Or $(TargetFrameworkVersion) == 'v8.1')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid') Or ($(TargetFrameworkIdentifier) == 'MonoTouch') Or ($(TargetFrameworkIdentifier) == 'Xamarin.iOS') Or ($(TargetFrameworkIdentifier) == 'Xamarin.Mac') Or ($(TargetFrameworkProfile) == 'Profile7') Or ($(TargetFrameworkProfile) == 'Profile31') Or ($(TargetFrameworkProfile) == 'Profile32') Or ($(TargetFrameworkProfile) == 'Profile44') Or ($(TargetFrameworkProfile) == 'Profile49') Or ($(TargetFrameworkProfile) == 'Profile78') Or ($(TargetFrameworkProfile) == 'Profile84') Or ($(TargetFrameworkProfile) == 'Profile111') Or ($(TargetFrameworkProfile) == 'Profile151') Or ($(TargetFrameworkProfile) == 'Profile157') Or ($(TargetFrameworkProfile) == 'Profile259')">
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\portable-net45+win8+wp8+wpa81+Xamarin.Mac+MonoAndroid10+MonoTouch10+Xamarin.iOS10\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
</Project>

58
src/FSharpUnitTests/DenseMatrixTests.fs

@ -2,6 +2,8 @@
open NUnit.Framework
open FsUnit
open FsUnitTyped
open MathNet.Numerics.LinearAlgebra
open MathNet.Numerics.Distributions
open MathNet.Numerics.Statistics
@ -19,94 +21,94 @@ module DenseMatrixTests =
[<Test>]
let ``DenseMatrix.zero`` () =
(DenseMatrix.zero 100 120) + largeM |> should equal largeM
(DenseMatrix.zero 100 120) + largeM |> shouldEqual largeM
[<Test>]
let ``DenseMatrix.random`` () =
let m = DenseMatrix.random 100 120 (Normal.WithMeanStdDev(100.0,0.1))
(m :?> Double.DenseMatrix).Values |> ArrayStatistics.Mean |> should (equalWithin 10.0) 100.0
m.RowCount |> should equal 100
m.ColumnCount |> should equal 120
m.RowCount |> shouldEqual 100
m.ColumnCount |> shouldEqual 120
[<Test>]
let ``DenseMatrix.create`` () =
DenseMatrix.create 3 2 0.3 |> should equal smallM
DenseMatrix.create 3 2 0.3 |> shouldEqual smallM
[<Test>]
let ``DenseMatrix.init`` () =
DenseMatrix.init 3 2 (fun i j -> 0.3) |> should equal smallM
DenseMatrix.init 100 120 (fun i j -> float i * 100.0 + float j) |> should equal largeM
DenseMatrix.init 3 2 (fun i j -> 0.3) |> shouldEqual smallM
DenseMatrix.init 100 120 (fun i j -> float i * 100.0 + float j) |> shouldEqual largeM
[<Test>]
let ``DenseMatrix.ofArray2`` () =
DenseMatrix.ofArray2 (array2D [[0.3;0.3];[0.3;0.3];[0.3;0.3]]) |> should equal smallM
DenseMatrix.ofArray2 (Array2D.create 3 2 0.3) |> should equal smallM
DenseMatrix.ofArray2 (Array2D.init 100 120 (fun i j -> float i * 100.0 + float j)) |> should equal largeM
DenseMatrix.ofArray2 (array2D [[0.3;0.3];[0.3;0.3];[0.3;0.3]]) |> shouldEqual smallM
DenseMatrix.ofArray2 (Array2D.create 3 2 0.3) |> shouldEqual smallM
DenseMatrix.ofArray2 (Array2D.init 100 120 (fun i j -> float i * 100.0 + float j)) |> shouldEqual largeM
[<Test>]
let ``DenseMatrix.ofMatrixArray2`` () =
let a = DenseMatrix.ofMatrixArray2 (array2D [[smallM;smallM];[smallM;smallM];[smallM;smallM]])
a.[0..2,0..1] |> should equal smallM
a.[3..5,2..3] |> should equal smallM
a.[6..8,0..1] |> should equal smallM
a.[0..2,0..1] |> shouldEqual smallM
a.[3..5,2..3] |> shouldEqual smallM
a.[6..8,0..1] |> shouldEqual smallM
[<Test>]
let ``DenseMatrix.ofMatrixList2`` () =
let a = DenseMatrix.ofMatrixList2 [[smallM; smallM]; [smallM; smallM]; [smallM; smallM]]
a.[0..2,0..1] |> should equal smallM
a.[3..5,2..3] |> should equal smallM
a.[6..8,0..1] |> should equal smallM
a.[0..2,0..1] |> shouldEqual smallM
a.[3..5,2..3] |> shouldEqual smallM
a.[6..8,0..1] |> shouldEqual smallM
[<Test>]
let ``DenseMatrix.ofRowSeq`` () =
DenseMatrix.ofRowSeq (Seq.ofList [[0.3;0.3];[0.3;0.3];[0.3;0.3]]) |> should equal smallM
DenseMatrix.ofRowSeq (Seq.ofList [[0.3;0.3];[0.3;0.3];[0.3;0.3]]) |> shouldEqual smallM
[<Test>]
let ``DenseMatrix.ofRowList`` () =
DenseMatrix.ofRowList [[0.3;0.3];[0.3;0.3];[0.3;0.3]] |> should equal smallM
DenseMatrix.ofRowList [[0.3;0.3];[0.3;0.3];[0.3;0.3]] |> shouldEqual smallM
[<Test>]
let ``DenseMatrix.ofRows`` () =
DenseMatrix.ofRows [vector [0.3;0.3]; vector [0.3;0.3]; vector [0.3;0.3]] |> should equal smallM
DenseMatrix.ofRows [vector [0.3;0.3]; vector [0.3;0.3]; vector [0.3;0.3]] |> shouldEqual smallM
[<Test>]
let ``DenseMatrix.ofColumnSeq`` () =
DenseMatrix.ofColumnSeq (Seq.ofList [[0.3;0.3;0.3];[0.3;0.3;0.3]]) |> should equal smallM
DenseMatrix.ofColumnSeq (Seq.ofList [[0.3;0.3;0.3];[0.3;0.3;0.3]]) |> shouldEqual smallM
[<Test>]
let ``DenseMatrix.ofColumnList`` () =
DenseMatrix.ofColumnList [[0.3;0.3;0.3];[0.3;0.3;0.3]] |> should equal smallM
DenseMatrix.ofColumnList [[0.3;0.3;0.3];[0.3;0.3;0.3]] |> shouldEqual smallM
[<Test>]
let ``DenseMatrix.ofColumns`` () =
DenseMatrix.ofColumns [vector [0.3;0.3;0.3]; vector [0.3;0.3;0.3]] |> should equal smallM
DenseMatrix.ofColumns [vector [0.3;0.3;0.3]; vector [0.3;0.3;0.3]] |> shouldEqual smallM
[<Test>]
let ``DenseMatrix.ofSeqi`` () =
seq { for i in 0 .. 99 do for j in 0 .. 119 -> (i,j, float i * 100.0 + float j)}
|> DenseMatrix.ofSeqi 100 120 |> should equal largeM
|> DenseMatrix.ofSeqi 100 120 |> shouldEqual largeM
[<Test>]
let ``DenseMatrix.ofListi`` () =
[ for i in 0 .. 99 do for j in 0 .. 119 -> (i,j, float i * 100.0 + float j) ]
|> DenseMatrix.ofListi 100 120 |> should equal largeM
|> DenseMatrix.ofListi 100 120 |> shouldEqual largeM
[<Test>]
let ``DenseMatrix.diag`` () =
DenseMatrix.diag 100 2.0 |> should equal (2.0 * (DenseMatrix.identity 100))
DenseMatrix.diag 100 2.0 |> shouldEqual (2.0 * (DenseMatrix.identity 100))
[<Test>]
let ``DenseMatrix.diag2`` () =
DenseMatrix.diag2 100 120 2.0 |> should equal (2.0 * (DenseMatrix.identity2 100 120))
DenseMatrix.diag2 100 120 2.0 |> shouldEqual (2.0 * (DenseMatrix.identity2 100 120))
[<Test>]
let ``DenseMatrix.ofDiag`` () =
DenseMatrix.ofDiag (DenseVector.init 100 (fun i -> 2.0)) |> should equal (2.0 * (DenseMatrix.identity 100))
DenseMatrix.ofDiag (DenseVector.init 100 (fun i -> 2.0)) |> shouldEqual (2.0 * (DenseMatrix.identity 100))
[<Test>]
let ``DenseMatrix.initRow`` () =
DenseMatrix.initRows 100 (fun i -> (DenseVector.init 120 (fun j -> float i * 100.0 + float j))) |> should equal largeM
DenseMatrix.initRows 100 (fun i -> (DenseVector.init 120 (fun j -> float i * 100.0 + float j))) |> shouldEqual largeM
[<Test>]
let ``DenseMatrix.initCol`` () =
DenseMatrix.initColumns 120 (fun j -> (DenseVector.init 100 (fun i -> float i * 100.0 + float j))) |> should equal largeM
DenseMatrix.initColumns 120 (fun j -> (DenseVector.init 100 (fun i -> float i * 100.0 + float j))) |> shouldEqual largeM

28
src/FSharpUnitTests/DenseVectorTests.fs

@ -2,6 +2,8 @@
open NUnit.Framework
open FsUnit
open FsUnitTyped
open MathNet.Numerics.LinearAlgebra
open MathNet.Numerics.Distributions
open MathNet.Numerics.Statistics
@ -10,50 +12,50 @@ open MathNet.Numerics.Statistics
module DenseVectorTests =
/// A small uniform vector.
let smallv = Double.DenseVector.Create(5, fun i -> 0.3)
let smallv = Double.DenseVector.Create(5, fun i -> 0.3) :> Vector<float>
/// A large vector with increasingly large entries
let largev = new Double.DenseVector( Array.init 100 (fun i -> float i / 100.0) )
let largev = new Double.DenseVector( Array.init 100 (fun i -> float i / 100.0) ) :> Vector<float>
[<Test>]
let ``DenseVector.zero`` () =
(DenseVector.zero 100) + largev |> should equal largev
(DenseVector.zero 100) + largev |> shouldEqual largev
[<Test>]
let ``DenseVector.random`` () =
let m = DenseVector.random 100 (Normal.WithMeanStdDev(100.0,0.1))
(m :?> Double.DenseVector).Values |> ArrayStatistics.Mean |> should (equalWithin 10.0) 100.0
m.Count |> should equal 100
m.Count |> shouldEqual 100
[<Test>]
let ``DenseVector.create`` () =
DenseVector.create 5 0.3 |> should equal smallv
DenseVector.create 5 0.3 |> shouldEqual smallv
[<Test>]
let ``DenseVector.init`` () =
DenseVector.init 5 (fun i -> 0.3) |> should equal smallv
DenseVector.init 100 (fun i -> float i / 100.0) |> should equal largev
DenseVector.init 5 (fun i -> 0.3) |> shouldEqual smallv
DenseVector.init 100 (fun i -> float i / 100.0) |> shouldEqual largev
[<Test>]
let ``DenseVector.ofList`` () =
DenseVector.ofList [ for i in 0 .. 99 -> float i / 100.0 ] |> should equal largev
DenseVector.ofList [ for i in 0 .. 99 -> float i / 100.0 ] |> shouldEqual largev
[<Test>]
let ``DenseVector.ofListi`` () =
DenseVector.ofListi 100 [ for i in 0 .. 99 -> i, float i / 100.0 ] |> should equal largev
DenseVector.ofListi 100 [ for i in 0 .. 99 -> i, float i / 100.0 ] |> shouldEqual largev
[<Test>]
let ``DenseVector.ofSeq`` () =
DenseVector.ofSeq (seq { for i in 0 .. 99 -> float i / 100.0 }) |> should equal largev
DenseVector.ofSeq (seq { for i in 0 .. 99 -> float i / 100.0 }) |> shouldEqual largev
[<Test>]
let ``DenseVector.ofSeqi`` () =
DenseVector.ofSeqi 100 (seq { for i in 99 .. -1 .. 0 -> i, float i / 100.0 }) |> should equal largev
DenseVector.ofSeqi 100 (seq { for i in 99 .. -1 .. 0 -> i, float i / 100.0 }) |> shouldEqual largev
[<Test>]
let ``DenseVector.rangef`` () =
DenseVector.rangef 0.0 0.01 0.99 |> should equal (DenseVector.raw [| for i in 0 .. 99 -> 0.01 * float i |])
DenseVector.rangef 0.0 0.01 0.99 |> shouldEqual (DenseVector.raw [| for i in 0 .. 99 -> 0.01 * float i |])
[<Test>]
let ``DenseVector.range`` () =
DenseVector.range 0 1 99 |> should equal (DenseVector.raw [| for i in 0 .. 99 -> float i |])
DenseVector.range 0 1 99 |> shouldEqual (DenseVector.raw [| for i in 0 .. 99 -> float i |])

65
src/FSharpUnitTests/FSharpUnitTests-Net35.fsproj

@ -56,6 +56,14 @@
</PropertyGroup>
<Import Project="$(FSharpTargetsPath)" Condition="Exists('$(FSharpTargetsPath)')" />
<ItemGroup>
<Compile Include="..\..\paket-files\fsprojects\FsUnit\src\FsUnit.NUnit\FsUnit.fs">
<Paket>True</Paket>
<Link>paket-files/FsUnit.fs</Link>
</Compile>
<Compile Include="..\..\paket-files\fsprojects\FsUnit\src\FsUnit.NUnit\FsUnitTyped.fs">
<Paket>True</Paket>
<Link>paket-files/FsUnitTyped.fs</Link>
</Compile>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="VectorTests.fs" />
<Compile Include="SparseVectorTests.fs" />
@ -170,23 +178,42 @@
</ItemGroup>
</When>
</Choose>
<ItemGroup>
<Reference Include="FsUnit.CustomMatchers">
<HintPath>..\..\packages\test\FsUnit\lib\FsUnit.CustomMatchers.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
<Reference Include="FsUnit.NUnit">
<HintPath>..\..\packages\test\FsUnit\lib\FsUnit.NUnit.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v3.0' Or $(TargetFrameworkVersion) == 'v3.5')">
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\net20\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0')">
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\net40\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1')">
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == 'WindowsPhoneApp') Or ($(TargetFrameworkIdentifier) == '.NETCore') Or ($(TargetFrameworkIdentifier) == 'WindowsPhone' And ($(TargetFrameworkVersion) == 'v8.0' Or $(TargetFrameworkVersion) == 'v8.1')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid') Or ($(TargetFrameworkIdentifier) == 'MonoTouch') Or ($(TargetFrameworkIdentifier) == 'Xamarin.iOS') Or ($(TargetFrameworkIdentifier) == 'Xamarin.Mac') Or ($(TargetFrameworkProfile) == 'Profile7') Or ($(TargetFrameworkProfile) == 'Profile31') Or ($(TargetFrameworkProfile) == 'Profile32') Or ($(TargetFrameworkProfile) == 'Profile44') Or ($(TargetFrameworkProfile) == 'Profile49') Or ($(TargetFrameworkProfile) == 'Profile78') Or ($(TargetFrameworkProfile) == 'Profile84') Or ($(TargetFrameworkProfile) == 'Profile111') Or ($(TargetFrameworkProfile) == 'Profile151') Or ($(TargetFrameworkProfile) == 'Profile157') Or ($(TargetFrameworkProfile) == 'Profile259')">
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\portable-net45+win8+wp8+wpa81+Xamarin.Mac+MonoAndroid10+MonoTouch10+Xamarin.iOS10\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
</Project>

4
src/FSharpUnitTests/FSharpUnitTests-Net35.fsproj.paket.references

@ -1,5 +1,7 @@
TaskParallelLibrary
File:FsUnit.fs
File:FsUnitTyped.fs
group Test
FsUnit
NUnit
FSharp.Core

65
src/FSharpUnitTests/FSharpUnitTests-Portable47.fsproj

@ -42,6 +42,14 @@
</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\paket-files\fsprojects\FsUnit\src\FsUnit.NUnit\FsUnit.fs">
<Paket>True</Paket>
<Link>paket-files/FsUnit.fs</Link>
</Compile>
<Compile Include="..\..\paket-files\fsprojects\FsUnit\src\FsUnit.NUnit\FsUnitTyped.fs">
<Paket>True</Paket>
<Link>paket-files/FsUnitTyped.fs</Link>
</Compile>
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core" />
@ -151,23 +159,42 @@
</ItemGroup>
</When>
</Choose>
<ItemGroup>
<Reference Include="FsUnit.CustomMatchers">
<HintPath>..\..\packages\test\FsUnit\lib\FsUnit.CustomMatchers.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
<Reference Include="FsUnit.NUnit">
<HintPath>..\..\packages\test\FsUnit\lib\FsUnit.NUnit.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v3.0' Or $(TargetFrameworkVersion) == 'v3.5')">
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\net20\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0')">
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\net40\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1')">
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == 'WindowsPhoneApp') Or ($(TargetFrameworkIdentifier) == '.NETCore') Or ($(TargetFrameworkIdentifier) == 'WindowsPhone' And ($(TargetFrameworkVersion) == 'v8.0' Or $(TargetFrameworkVersion) == 'v8.1')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid') Or ($(TargetFrameworkIdentifier) == 'MonoTouch') Or ($(TargetFrameworkIdentifier) == 'Xamarin.iOS') Or ($(TargetFrameworkIdentifier) == 'Xamarin.Mac') Or ($(TargetFrameworkProfile) == 'Profile7') Or ($(TargetFrameworkProfile) == 'Profile31') Or ($(TargetFrameworkProfile) == 'Profile32') Or ($(TargetFrameworkProfile) == 'Profile44') Or ($(TargetFrameworkProfile) == 'Profile49') Or ($(TargetFrameworkProfile) == 'Profile78') Or ($(TargetFrameworkProfile) == 'Profile84') Or ($(TargetFrameworkProfile) == 'Profile111') Or ($(TargetFrameworkProfile) == 'Profile151') Or ($(TargetFrameworkProfile) == 'Profile157') Or ($(TargetFrameworkProfile) == 'Profile259')">
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\portable-net45+win8+wp8+wpa81+Xamarin.Mac+MonoAndroid10+MonoTouch10+Xamarin.iOS10\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
</Project>

65
src/FSharpUnitTests/FSharpUnitTests.fsproj

@ -51,6 +51,14 @@
<DefineConstants>$(DefineConstants);NOFSSLICESET1D</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\paket-files\fsprojects\FsUnit\src\FsUnit.NUnit\FsUnit.fs">
<Paket>True</Paket>
<Link>paket-files/FsUnit.fs</Link>
</Compile>
<Compile Include="..\..\paket-files\fsprojects\FsUnit\src\FsUnit.NUnit\FsUnitTyped.fs">
<Paket>True</Paket>
<Link>paket-files/FsUnitTyped.fs</Link>
</Compile>
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core" />
@ -161,23 +169,42 @@
</ItemGroup>
</When>
</Choose>
<ItemGroup>
<Reference Include="FsUnit.CustomMatchers">
<HintPath>..\..\packages\test\FsUnit\lib\FsUnit.CustomMatchers.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
<Reference Include="FsUnit.NUnit">
<HintPath>..\..\packages\test\FsUnit\lib\FsUnit.NUnit.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v3.0' Or $(TargetFrameworkVersion) == 'v3.5')">
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\net20\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0')">
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\net40\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1')">
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == 'WindowsPhoneApp') Or ($(TargetFrameworkIdentifier) == '.NETCore') Or ($(TargetFrameworkIdentifier) == 'WindowsPhone' And ($(TargetFrameworkVersion) == 'v8.0' Or $(TargetFrameworkVersion) == 'v8.1')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid') Or ($(TargetFrameworkIdentifier) == 'MonoTouch') Or ($(TargetFrameworkIdentifier) == 'Xamarin.iOS') Or ($(TargetFrameworkIdentifier) == 'Xamarin.Mac') Or ($(TargetFrameworkProfile) == 'Profile7') Or ($(TargetFrameworkProfile) == 'Profile31') Or ($(TargetFrameworkProfile) == 'Profile32') Or ($(TargetFrameworkProfile) == 'Profile44') Or ($(TargetFrameworkProfile) == 'Profile49') Or ($(TargetFrameworkProfile) == 'Profile78') Or ($(TargetFrameworkProfile) == 'Profile84') Or ($(TargetFrameworkProfile) == 'Profile111') Or ($(TargetFrameworkProfile) == 'Profile151') Or ($(TargetFrameworkProfile) == 'Profile157') Or ($(TargetFrameworkProfile) == 'Profile259')">
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\test\NUnit\lib\portable-net45+win8+wp8+wpa81+Xamarin.Mac+MonoAndroid10+MonoTouch10+Xamarin.iOS10\nunit.framework.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
</Project>

30
src/FSharpUnitTests/FindRootsTests.fs

@ -1,9 +1,11 @@
namespace MathNet.Numerics.Tests
open System
open MathNet.Numerics
open NUnit.Framework
open FsUnit
open FsUnitTyped
open System
open MathNet.Numerics
module FindRootsTests =
@ -19,33 +21,33 @@ module FindRootsTests =
[<Test>]
let ``Bisection should find both roots of (x - 3) * (x - 4)``() =
f |> FindRoots.bisection 100 1e-14 -5.0 3.5 |> should equal (Some 3.0)
f |> FindRoots.bisection 100 1e-14 3.2 5.0 |> should equal (Some 4.0)
f |> FindRoots.bisection 100 1e-14 -5.0 3.5 |> shouldEqual (Some 3.0)
f |> FindRoots.bisection 100 1e-14 3.2 5.0 |> shouldEqual (Some 4.0)
[<Test>]
let ``Brent should find both roots of (x - 3) * (x - 4)``() =
f |> FindRoots.brent 100 1e-14 -5.0 3.5 |> should equal (Some 3.0)
f |> FindRoots.brent 100 1e-14 3.2 5.0 |> should equal (Some 4.0)
f |> FindRoots.brent 100 1e-14 -5.0 3.5 |> shouldEqual (Some 3.0)
f |> FindRoots.brent 100 1e-14 3.2 5.0 |> shouldEqual (Some 4.0)
[<Test>]
let ``Newton-Raphson should find both roots of (x - 3) * (x - 4)``() =
(f, df) ||> FindRoots.newtonRaphson 100 1e-14 -5.0 3.5 |> should equal (Some 3.0)
(f, df) ||> FindRoots.newtonRaphson 100 1e-14 3.2 5.0 |> should equal (Some 4.0)
(f, df) ||> FindRoots.newtonRaphson 100 1e-14 -5.0 3.5 |> shouldEqual (Some 3.0)
(f, df) ||> FindRoots.newtonRaphson 100 1e-14 3.2 5.0 |> shouldEqual (Some 4.0)
[<Test>]
let ``Newton-Raphson by Guess should find both roots of (x - 3) * (x - 4)``() =
(f, df) ||> FindRoots.newtonRaphsonGuess 100 1e-14 2.8 |> should equal (Some 3.0)
(f, df) ||> FindRoots.newtonRaphsonGuess 100 1e-14 3.7 |> should equal (Some 4.0)
(f, df) ||> FindRoots.newtonRaphsonGuess 100 1e-14 2.8 |> shouldEqual (Some 3.0)
(f, df) ||> FindRoots.newtonRaphsonGuess 100 1e-14 3.7 |> shouldEqual (Some 4.0)
[<Test>]
let ``Robust Newton-Raphson should find both roots of (x - 3) * (x - 4)``() =
(f, df) ||> FindRoots.newtonRaphsonRobust 100 20 1e-14 -5.0 3.5 |> should equal (Some 3.0)
(f, df) ||> FindRoots.newtonRaphsonRobust 100 20 1e-14 3.2 5.0 |> should equal (Some 4.0)
(f, df) ||> FindRoots.newtonRaphsonRobust 100 20 1e-14 -5.0 3.5 |> shouldEqual (Some 3.0)
(f, df) ||> FindRoots.newtonRaphsonRobust 100 20 1e-14 3.2 5.0 |> shouldEqual (Some 4.0)
[<Test>]
let ``Bryoden should find both roots of (x - 3) * (x - 4) and Twoeq2``() =
f |> (fun g (x:float[]) -> [|g x.[0]|]) |> FindRoots.broyden 100 1e-14 [|1.0;|] |> should equal (Some [|3.0|])
f |> (fun g (x:float[]) -> [|g x.[0]|]) |> FindRoots.broyden 100 1e-14 [|9.0;|] |> should equal (Some [|4.0|])
f |> (fun g (x:float[]) -> [|g x.[0]|]) |> FindRoots.broyden 100 1e-14 [|1.0;|] |> shouldEqual (Some [|3.0|])
f |> (fun g (x:float[]) -> [|g x.[0]|]) |> FindRoots.broyden 100 1e-14 [|9.0;|] |> shouldEqual (Some [|4.0|])
g |> FindRoots.broyden 100 1e-6 [|1.0; 400.0;|] |> (fun x ->
match x with
| Some x -> should (equalWithin 1e-1) [|0.9638680512795; 346.16369814640|]

6
src/FSharpUnitTests/FitTests.fs

@ -1,9 +1,11 @@
namespace MathNet.Numerics.Tests
open System
open MathNet.Numerics
open NUnit.Framework
open FsUnit
open FsUnitTyped
open System
open MathNet.Numerics
module FitTests =

82
src/FSharpUnitTests/MatrixTests.fs

@ -2,6 +2,8 @@
open NUnit.Framework
open FsUnit
open FsUnitTyped
open MathNet.Numerics.LinearAlgebra
/// Unit tests for the matrix type.
@ -21,85 +23,85 @@ module MatrixTests =
[<Test>]
let ``Matrix.GetSlice`` () =
largeM.[*,*] |> should equal largeM
largeM.[0..99,0..99] |> should equal largeM
largeM.[1..2,1..2] |> should equal (DenseMatrix.raw 2 2 [|101.;201.;102.;202.|])
largeM.[98..,98..] |> should equal (DenseMatrix.raw 2 2 [|9898.;9998.;9899.;9999.|])
largeM.[..1,..1] |> should equal (DenseMatrix.raw 2 2 [|0.;100.;1.;101.|])
largeM.[*,*] |> shouldEqual largeM
largeM.[0..99,0..99] |> shouldEqual largeM
largeM.[1..2,1..2] |> shouldEqual (DenseMatrix.raw 2 2 [|101.;201.;102.;202.|])
largeM.[98..,98..] |> shouldEqual (DenseMatrix.raw 2 2 [|9898.;9998.;9899.;9999.|])
largeM.[..1,..1] |> shouldEqual (DenseMatrix.raw 2 2 [|0.;100.;1.;101.|])
[<Test>]
let ``Matrix.SetSlice`` () =
let m = DenseMatrix.init 2 2 (fun i j -> float i * 100.0 + float j) in
m.[*,*] <- matrix [[5.;7.];[6.;8.]];
m |> should equal (DenseMatrix.raw 2 2 [|5.;6.;7.;8.|])
m |> shouldEqual (DenseMatrix.raw 2 2 [|5.;6.;7.;8.|])
let m = DenseMatrix.init 2 2 (fun i j -> float i * 100.0 + float j) in
m.[0..1,0..1] <-matrix [[5.;7.];[6.;8.]];
m |> should equal (DenseMatrix.raw 2 2 [|5.;6.;7.;8.|])
m |> shouldEqual (DenseMatrix.raw 2 2 [|5.;6.;7.;8.|])
let m = DenseMatrix.init 4 4 (fun i j -> float i * 100.0 + float j) in
m.[1..2,1..2] <- matrix [[5.;7.];[6.;8.]];
m |> should equal (DenseMatrix.raw 4 4 [|0.;100.;200.;300.;1.;5.;6.;301.;2.;7.;8.;302.;3.;103.;203.;303.|])
m |> shouldEqual (DenseMatrix.raw 4 4 [|0.;100.;200.;300.;1.;5.;6.;301.;2.;7.;8.;302.;3.;103.;203.;303.|])
let m = DenseMatrix.init 4 4 (fun i j -> float i * 100.0 + float j) in
m.[2..,..1] <- matrix [[5.;7.];[6.;8.]];
m |> should equal (DenseMatrix.raw 4 4 [|0.;100.;5.;6.;1.;101.;7.;8.;2.;102.;202.;302.;3.;103.;203.;303.|])
m |> shouldEqual (DenseMatrix.raw 4 4 [|0.;100.;5.;6.;1.;101.;7.;8.;2.;102.;202.;302.;3.;103.;203.;303.|])
let m = DenseMatrix.init 4 4 (fun i j -> float i * 100.0 + float j) in
m.[..1,2..] <- matrix [[5.;7.];[6.;8.]];
m |> should equal (DenseMatrix.raw 4 4 [|0.;100.;200.;300.;1.;101.;201.;301.;5.;6.;202.;302.;7.;8.;203.;303.|])
m |> shouldEqual (DenseMatrix.raw 4 4 [|0.;100.;200.;300.;1.;101.;201.;301.;5.;6.;202.;302.;7.;8.;203.;303.|])
[<Test>]
let ``Matrix.toArray2`` () =
Matrix.toArray2 smallM |> should equal (Array2D.create 2 2 0.3)
Matrix.toArray2 smallM |> shouldEqual (Array2D.create 2 2 0.3)
[<Test>]
let ``Matrix.mapInPlace.Dense`` () =
let M = largeM.Clone()
M |> Matrix.mapInPlace (fun x -> 3.0 * x)
M |> should equal (3.0 * largeM)
M |> shouldEqual (3.0 * largeM)
[<Test>]
let ``Matrix.mapInPlace.Sparse`` () =
let M = sparseM.Clone()
M |> Matrix.mapInPlace (fun x -> 3.0 * x)
M |> should equal (3.0 * sparseM)
M |> shouldEqual (3.0 * sparseM)
[<Test>]
let ``Matrix.mapSkipZerosInPlace.Sparse`` () =
let M = sparseM.Clone()
M |> Matrix.mapSkipZerosInPlace (fun x -> 3.0 * x)
M |> should equal (3.0 * sparseM)
M |> shouldEqual (3.0 * sparseM)
[<Test>]
let ``Matrix.mapiInPlace.Dense`` () =
let M = largeM.Clone()
M |> Matrix.mapiInPlace (fun i j x -> 2.0 * (float i * 100.0 + float j) + x)
M |> should equal (3.0 * largeM)
M |> shouldEqual (3.0 * largeM)
[<Test>]
let ``Matrix.mapiInPlace.Sparse`` () =
let M = sparseM.Clone()
M |> Matrix.mapiInPlace (fun i j x -> if i=j then 2.0*x+1.0 else 2.0*x)
M |> should equal (2.0 * sparseM + SparseMatrix.init 2 3 (fun i j -> if i=j then 1.0 else 0.0))
M |> shouldEqual (2.0 * sparseM + SparseMatrix.init 2 3 (fun i j -> if i=j then 1.0 else 0.0))
[<Test>]
let ``Matrix.mapiSkipZerosInPlace.Sparse`` () =
let M = sparseM.Clone()
M |> Matrix.mapiSkipZerosInPlace (fun i j x -> 2.0*x)
M |> should equal (2.0 * sparseM)
M |> shouldEqual (2.0 * sparseM)
[<Test>]
let ``Matrix.map`` () =
Matrix.map (fun x -> 2.0 * x) smallM |> should equal (2.0 * smallM)
Matrix.map (fun x -> 2.0 * x) smallM |> shouldEqual (2.0 * smallM)
[<Test>]
let ``Matrix.mapSkipZeros`` () =
Matrix.mapSkipZeros (fun x -> 2.0 * x) smallM |> should equal (2.0 * smallM)
Matrix.mapSkipZeros (fun x -> 2.0 * x) smallM |> shouldEqual (2.0 * smallM)
[<Test>]
let ``Matrix.mapi`` () =
Matrix.mapi (fun i j x -> float i * 100.0 + float j + x) largeM |> should equal (2.0 * largeM)
Matrix.mapi (fun i j x -> float i * 100.0 + float j + x) largeM |> shouldEqual (2.0 * largeM)
[<Test>]
let ``Matrix.mapiSkipZeros`` () =
Matrix.mapiSkipZeros (fun i j x -> float i * 100.0 + float j + x) largeM |> should equal (2.0 * largeM)
Matrix.mapiSkipZeros (fun i j x -> float i * 100.0 + float j + x) largeM |> shouldEqual (2.0 * largeM)
[<Test>]
let ``Matrix.mapCols`` () =
@ -111,80 +113,80 @@ module MatrixTests =
[<Test>]
let ``Matrix.fold`` () =
Matrix.fold (fun a b -> a - b) 0.0 smallM |> should equal -1.2
Matrix.fold (fun a b -> a - b) 0.0 smallM |> shouldEqual -1.2
[<Test>]
let ``Matrix.foldBack`` () =
Matrix.foldBack (fun a b -> a - b) 0.0 smallM |> should equal 0.0
Matrix.foldBack (fun a b -> a - b) 0.0 smallM |> shouldEqual 0.0
[<Test>]
let ``Matrix.foldBackSummation`` () =
Matrix.foldBack( fun a b -> a + b) 0.0 failingFoldBackM |> should equal 6.0
Matrix.foldBack( fun a b -> a + b) 0.0 failingFoldBackM |> shouldEqual 6.0
[<Test>]
let ``Matrix.foldi`` () =
Matrix.foldi (fun i j acc x -> acc + x + float (i+j)) 0.0 smallM |> should equal 5.2
Matrix.foldi (fun i j acc x -> acc + x + float (i+j)) 0.0 smallM |> shouldEqual 5.2
[<Test>]
let ``Matrix.forall`` () =
Matrix.forall (fun x -> x = 0.3) smallM |> should equal true
Matrix.forall (fun x -> x = 0.3) smallM |> shouldEqual true
[<Test>]
let ``Matrix.exists`` () =
Matrix.exists (fun x -> x = 0.5) smallM |> should equal false
Matrix.exists (fun x -> x = 0.5) smallM |> shouldEqual false
[<Test>]
let ``Matrix.foralli`` () =
Matrix.foralli (fun i j x -> x = float i * 100.0 + float j) largeM |> should equal true
Matrix.foralli (fun i j x -> x = float i * 100.0 + float j) largeM |> shouldEqual true
[<Test>]
let ``Matrix.existsi`` () =
Matrix.existsi (fun i j x -> x = float i * 100.0 + float j) largeM |> should equal true
Matrix.existsi (fun i j x -> x = float i * 100.0 + float j) largeM |> shouldEqual true
[<Test>]
let ``Matrix.inplaceAssign`` () =
let N = smallM.Clone()
N |> Matrix.inplaceAssign (fun i j -> 0.0)
N |> should equal (0.0 * smallM)
N |> shouldEqual (0.0 * smallM)
[<Test>]
let ``Matrix.toSeqSkipZeros`` () =
Seq.length (Matrix.toSeqSkipZeros smallM) |> should equal 4
Seq.length (Matrix.toSeqSkipZeros smallM) |> shouldEqual 4
[<Test>]
let ``Matrix.sum`` () =
Matrix.sum smallM |> should equal 1.2
Matrix.sum smallM |> shouldEqual 1.2
[<Test>]
let ``Matrix.sumColsBy`` () =
Matrix.sumColsBy (fun j col -> col.[0] * col.[1]) (matrix [[1.0; 2.0]; [3.0; 4.0]]) |> should equal 11.0
Matrix.sumColsBy (fun j col -> col.[0] * col.[1]) (matrix [[1.0; 2.0]; [3.0; 4.0]]) |> shouldEqual 11.0
[<Test>]
let ``Matrix.sumRowsBy`` () =
Matrix.sumRowsBy (fun i row -> row.[0] * row.[1]) (matrix [[1.0; 2.0]; [3.0; 4.0]]) |> should equal 14.0
Matrix.sumRowsBy (fun i row -> row.[0] * row.[1]) (matrix [[1.0; 2.0]; [3.0; 4.0]]) |> shouldEqual 14.0
[<Test>]
let ``Matrix.foldCol`` () =
Matrix.foldCol (+) 0.0 largeM 0 |> should equal 495000.0
Matrix.foldCol (+) 0.0 largeM 0 |> shouldEqual 495000.0
[<Test>]
let ``Matrix.foldRow`` () =
Matrix.foldRow (+) 0.0 largeM 0 |> should equal 4950.0
Matrix.foldRow (+) 0.0 largeM 0 |> shouldEqual 4950.0
[<Test>]
let ``Matrix.foldByCol`` () =
Matrix.foldByCol (+) 0.0 smallM |> should equal (DenseVector.ofList [0.6;0.6])
Matrix.foldByCol (+) 0.0 smallM |> shouldEqual (DenseVector.ofList [0.6;0.6])
[<Test>]
let ``Matrix.foldByRow`` () =
Matrix.foldByRow (+) 0.0 smallM |> should equal (DenseVector.ofList [0.6;0.6])
Matrix.foldByRow (+) 0.0 smallM |> shouldEqual (DenseVector.ofList [0.6;0.6])
[<Test>]
let ``Pointwise Multiplication using .* Operator`` () =
let z = largeM .* largeM
z |> should equal (DenseMatrix.init 100 100 (fun i j -> (float i * 100.0 + float j) ** 2.0))
z |> shouldEqual (DenseMatrix.init 100 100 (fun i j -> (float i * 100.0 + float j) ** 2.0))
[<Test>]
let ``Pointwise Division using ./ Operator`` () =
let z = largeM ./ DenseMatrix.create 100 100 2.0
z |> should equal (largeM * 0.5)
z |> shouldEqual (largeM * 0.5)

21
src/FSharpUnitTests/PokerTests.fs

@ -5,10 +5,11 @@
#nowarn "25"
open NUnit.Framework
open FsUnitTyped
open MathNet.Numerics
open MathNet.Numerics.Probability
open NUnit.Framework
open FsUnit
type Rank = int
type Suit = | Spades | Hearts | Diamonds | Clubs
@ -39,7 +40,7 @@ let ``When drawing from a full deck, then the probability for an Ace should equa
|> RandomVariable.map fst
|> RandomVariable.filter (fun card -> value card = A)
|> RandomVariable.probability
|> should equal (4N/52N)
|> shouldEqual (4N/52N)
[<Test>]
let ``When drawing from a full deck, then the probability should equal 1/52``() =
@ -48,7 +49,7 @@ let ``When drawing from a full deck, then the probability should equal 1/52``()
|> RandomVariable.map fst
|> RandomVariable.filter ((=) (A,Spades))
|> RandomVariable.probability
|> should equal (1N/52N)
|> shouldEqual (1N/52N)
[<Test>]
let ``When drawing from a full deck, then the probability for the Ace of Clubs and Ace of Spaces (in order) should equal 1/52 * 1/51``() =
@ -56,7 +57,7 @@ let ``When drawing from a full deck, then the probability for the Ace of Clubs a
|> RandomVariable.select 2
|> RandomVariable.filter ((=) [A,Clubs; A,Spades])
|> RandomVariable.probability
|> should equal (1N/52N * 1N/51N)
|> shouldEqual (1N/52N * 1N/51N)
[<Test>]
let ``When drawing from a full deck, then the probability for the Ace of Clubs and Ace of Spaces (in any order) should equal (1/52 * 1/51) * 2``() =
@ -64,7 +65,7 @@ let ``When drawing from a full deck, then the probability for the Ace of Clubs a
|> RandomVariable.select 2
|> RandomVariable.filterInAnyOrder [A,Clubs; A,Spades]
|> RandomVariable.probability
|> should equal ((1N/52N * 1N/51N) * 2N)
|> shouldEqual ((1N/52N * 1N/51N) * 2N)
[<Test>]
let ``When drawing the Ace of Spades and the Ace of Clubs, then the probability for drawing another Ace should equal 2/50``() =
@ -73,7 +74,7 @@ let ``When drawing the Ace of Spades and the Ace of Clubs, then the probability
|> RandomVariable.toUniformDistribution
|> RandomVariable.filter (fun card -> value card = A)
|> RandomVariable.probability
|> should equal (2N/50N)
|> shouldEqual (2N/50N)
[<Test>]
@ -82,7 +83,7 @@ let ``When drawing from the full deck, then the probability for drawing a Pair p
|> RandomVariable.select 2
|> RandomVariable.filter (fun (c1::c2::_) -> isPair c1 c2)
|> RandomVariable.probability
|> should equal (1N/17N)
|> shouldEqual (1N/17N)
[<Test>]
let ``When drawing from the full deck, then the probability for drawing Suited Connectors should equal 1/25``() =
@ -90,7 +91,7 @@ let ``When drawing from the full deck, then the probability for drawing Suited C
|> RandomVariable.select 2
|> RandomVariable.filter (fun (c1::c2::_) -> isSuited c1 c2 && isConnected c1 c2)
|> RandomVariable.probability
|> should equal (2N/51N)
|> shouldEqual (2N/51N)
[<Test>]
let ``When holding 3 Spades after the flop, than the probability for drawing a flush should equal 10/47*9/46``() =
@ -100,6 +101,6 @@ let ``When holding 3 Spades after the flop, than the probability for drawing a f
|> RandomVariable.select 2
|> RandomVariable.filter (fun (c1::c2::_) -> suit c1 = Spades && suit c2 = Spades)
|> RandomVariable.probability
|> should equal (10N/47N*9N/46N)
|> shouldEqual (10N/47N*9N/46N)
#endif

27
src/FSharpUnitTests/QuaternionTests.fs

@ -1,8 +1,9 @@
namespace MathNet.Numerics.Tests
open System
open NUnit.Framework
open FsUnit
open FsUnitTyped
open System
open MathNet.Numerics
module QuaternionTests =
@ -18,52 +19,52 @@ module QuaternionTests =
let ``Quaternion.create`` () =
let fourtyFiveDegreesInRadians = 45.0 * Math.PI / 180.0
Quaternion.create fourtyFiveDegreesInRadians 1.0 0.0 0.0 |>
should equal {w = 0.92387953251128674; x = 0.38268343236508978; y = 0.0; z = 0.0;}
shouldEqual {w = 0.92387953251128674; x = 0.38268343236508978; y = 0.0; z = 0.0;}
[<Test>]
let ``Quaternion.create normalizes input vector`` () =
let fourtyFiveDegreesInRadians = 45.0 * Math.PI / 180.0
Quaternion.create fourtyFiveDegreesInRadians 100.0 0.0 0.0 |>
should equal <|
shouldEqual <|
Quaternion.create fourtyFiveDegreesInRadians 1.0 0.0 0.0
[<Test>]
let ``Quaternion.+`` () =
n + n' |> should equal {w= 1.5;x= -0.5;y= 1.5;z= 0.0}
n + n' |> shouldEqual {w= 1.5;x= -0.5;y= 1.5;z= 0.0}
[<Test>]
let ``Quaternion.-`` () =
n - n' |> should equal {w= 0.5;x= 0.5;y= 0.5;z= 0.0}
n - n' |> shouldEqual {w= 0.5;x= 0.5;y= 0.5;z= 0.0}
[<Test>]
let ``Quaternion.* r*q'`` () =
r * q |> should equal {w = -8.0; x = -16.0; y = -24.0; z = -2.0;}
r * q |> shouldEqual {w = -8.0; x = -16.0; y = -24.0; z = -2.0;}
[<Test>]
let ``Quaternion.* q*r`` () =
q * r |> should equal {w = -8.0; x = 6.0; y = -4.0; z = -28.0;}
q * r |> shouldEqual {w = -8.0; x = 6.0; y = -4.0; z = -28.0;}
//http://www.mathworks.com/help/aerotbx/ug/quatnorm.html
[<Test>]
let ``Quaternion.NormSquared`` () =
Quaternion.normSquared n' |> should equal 0.75
Quaternion.normSquared n' |> shouldEqual 0.75
//http://www.mathworks.com/help/aerotbx/ug/quatnormalize.html
[<Test>]
let ``Quaternion.Normalize`` () =
Quaternion.normalize n |> should equal {w= 0.70710678118654746; x= 0.0; y= 0.70710678118654746; z= 0.0}
Quaternion.normalize n |> shouldEqual {w= 0.70710678118654746; x= 0.0; y= 0.70710678118654746; z= 0.0}
//http://www.mathworks.com/help/aerotbx/ug/quatinv.html
[<Test>]
let ``Quaternion.Inverse`` () =
Quaternion.inverse n |> should equal {w= 0.5;x= 0.0;y= -0.5;z= 0.0}
Quaternion.inverse n |> shouldEqual {w= 0.5;x= 0.0;y= -0.5;z= 0.0}
//http://www.mathworks.com/help/aerotbx/ug/quatconj.html
[<Test>]
let ``Quaternion.Conjugate`` () =
Quaternion.conjugate n |> should equal {w= 1.0;x= 0.0;y= -1.0;z= 0.0}
Quaternion.conjugate n |> shouldEqual {w= 1.0;x= 0.0;y= -1.0;z= 0.0}
//http://www.mathworks.com/help/aerotbx/ug/quatrotate.html
[<Test>]
let ``Quaternion.Rotate`` () =
Quaternion.rotate n 1.0 1.0 1.0 |> should equal {w= 0.0;x= -1.0;y= 1.0;z= 1.0}
Quaternion.rotate n 1.0 1.0 1.0 |> shouldEqual {w= 0.0;x= -1.0;y= 1.0;z= 1.0}

17
src/FSharpUnitTests/RandomVariableTests.fs

@ -3,15 +3,16 @@
#if NOSYSNUMERICS
#else
open NUnit.Framework
open FsUnitTyped
open MathNet.Numerics
open MathNet.Numerics.Probability
open NUnit.Framework
open FsUnit
[<Test>]
let ``When creating a empty randomVariable, then the probability should be 1``() =
let actual = randomVariable { return () }
RandomVariable.probability actual |> should equal (1N/1N)
RandomVariable.probability actual |> shouldEqual (1N/1N)
let sumOfTwoFairDices = randomVariable {
let! d1 = RandomVariable.fairDice 6
@ -23,7 +24,7 @@ let ``When creating two fair dices, then P(Sum of 2 dices = 7) should be 1/6``()
sumOfTwoFairDices
|> RandomVariable.filter ((=) 7)
|> RandomVariable.probability
|> should equal (1N/6N)
|> shouldEqual (1N/6N)
let fairCoinAndDice = randomVariable {
let! d = RandomVariable.fairDice 6
@ -35,14 +36,14 @@ let ``When creating a fair coin and a fair dice, then P(Heads) should be 1/2``()
fairCoinAndDice
|> RandomVariable.filter (fun (_,c) -> c = Heads)
|> RandomVariable.probability
|> should equal (1N/2N)
|> shouldEqual (1N/2N)
[<Test>]
let ``When creating a fair coin and a fair dice, then P(Heads and dice > 3) should be 1/4``() =
fairCoinAndDice
|> RandomVariable.filter (fun (d,c) -> c = Heads && d > 3)
|> RandomVariable.probability
|> should equal (1N/4N)
|> shouldEqual (1N/4N)
// MontyHall Problem
// See Martin Erwig and Steve Kollmansberger's paper
@ -68,7 +69,7 @@ let ``When making the first choice in a MontyHall situation, the chances to win
firstChoice
|> RandomVariable.filter ((=) Car)
|> RandomVariable.probability
|> should equal (1N/3N)
|> shouldEqual (1N/3N)
let montyHallWithSwitch = randomVariable {
let! firstDoor = firstChoice
@ -79,6 +80,6 @@ let ``When switching in a MontyHall situation, the chances to win should be 2/3`
montyHallWithSwitch
|> RandomVariable.filter ((=) Car)
|> RandomVariable.probability
|> should equal (2N/3N)
|> shouldEqual (2N/3N)
#endif

45
src/FSharpUnitTests/SparseMatrixTests.fs

@ -1,7 +1,8 @@
namespace MathNet.Numerics.Tests
open NUnit.Framework
open FsUnit
open FsUnitTyped
open MathNet.Numerics.LinearAlgebra
/// Unit tests for the sparse matrix type.
@ -12,71 +13,71 @@ module SparseMatrixTests =
[<Test>]
let ``SparseMatrix.zero`` () =
(SparseMatrix.zero 4 6) + smallM |> should equal smallM
(SparseMatrix.zero 4 6) + smallM |> shouldEqual smallM
[<Test>]
let ``SparseMatrix.init`` () =
SparseMatrix.init 4 6 (fun i j -> if i = 1 && j = 2 then 1.0 else 0.0) |> should equal smallM
SparseMatrix.init 4 6 (fun i j -> if i = 1 && j = 2 then 1.0 else 0.0) |> shouldEqual smallM
[<Test>]
let ``SparseMatrix.ofArray2`` () =
SparseMatrix.ofArray2 (array2D [[0.;0.;0.;0.;0.;0.];[0.;0.;1.;0.;0.;0.];[0.;0.;0.;0.;0.;0.];[0.;0.;0.;0.;0.;0.]]) |> should equal smallM
SparseMatrix.ofArray2 (Array2D.init 4 6 (fun i j -> if i = 1 && j = 2 then 1.0 else 0.0)) |> should equal smallM
SparseMatrix.ofArray2 (array2D [[0.;0.;0.;0.;0.;0.];[0.;0.;1.;0.;0.;0.];[0.;0.;0.;0.;0.;0.];[0.;0.;0.;0.;0.;0.]]) |> shouldEqual smallM
SparseMatrix.ofArray2 (Array2D.init 4 6 (fun i j -> if i = 1 && j = 2 then 1.0 else 0.0)) |> shouldEqual smallM
[<Test>]
let ``SparseMatrix.ofMatrixArray2`` () =
let a = SparseMatrix.ofMatrixArray2 (array2D [[smallM;smallM];[smallM;smallM];[smallM;smallM]])
a.[0..3,0..5] |> should equal smallM
a.[4..7,6..11] |> should equal smallM
a.[8..11,0..5] |> should equal smallM
a.[0..3,0..5] |> shouldEqual smallM
a.[4..7,6..11] |> shouldEqual smallM
a.[8..11,0..5] |> shouldEqual smallM
[<Test>]
let ``SparseMatrix.ofMatrixList2`` () =
let a = SparseMatrix.ofMatrixList2 [[smallM; smallM]; [smallM; smallM]; [smallM; smallM]]
a.[0..3,0..5] |> should equal smallM
a.[4..7,6..11] |> should equal smallM
a.[8..11,0..5] |> should equal smallM
a.[0..3,0..5] |> shouldEqual smallM
a.[4..7,6..11] |> shouldEqual smallM
a.[8..11,0..5] |> shouldEqual smallM
[<Test>]
let ``SparseMatrix.ofRowSeq`` () =
SparseMatrix.ofRowSeq (Seq.ofList [[0.;0.;0.;0.;0.;0.];[0.;0.;1.;0.;0.;0.];[0.;0.;0.;0.;0.;0.];[0.;0.;0.;0.;0.;0.]]) |> should equal smallM
SparseMatrix.ofRowSeq (Seq.ofList [[0.;0.;0.;0.;0.;0.];[0.;0.;1.;0.;0.;0.];[0.;0.;0.;0.;0.;0.];[0.;0.;0.;0.;0.;0.]]) |> shouldEqual smallM
[<Test>]
let ``SparseMatrix.ofRowList`` () =
SparseMatrix.ofRowList [[0.;0.;0.;0.;0.;0.];[0.;0.;1.;0.;0.;0.];[0.;0.;0.;0.;0.;0.];[0.;0.;0.;0.;0.;0.]] |> should equal smallM
SparseMatrix.ofRowList [[0.;0.;0.;0.;0.;0.];[0.;0.;1.;0.;0.;0.];[0.;0.;0.;0.;0.;0.];[0.;0.;0.;0.;0.;0.]] |> shouldEqual smallM
[<Test>]
let ``SparseMatrix.ofColumnSeq`` () =
SparseMatrix.ofColumnSeq (Seq.ofList [[0.;0.;0.;0.];[0.;0.;0.;0.];[0.;1.;0.;0.];[0.;0.;0.;0.];[0.;0.;0.;0.];[0.;0.;0.;0.]]) |> should equal smallM
SparseMatrix.ofColumnSeq (Seq.ofList [[0.;0.;0.;0.];[0.;0.;0.;0.];[0.;1.;0.;0.];[0.;0.;0.;0.];[0.;0.;0.;0.];[0.;0.;0.;0.]]) |> shouldEqual smallM
[<Test>]
let ``SparseMatrix.ofColumnList`` () =
SparseMatrix.ofColumnList [[0.;0.;0.;0.];[0.;0.;0.;0.];[0.;1.;0.;0.];[0.;0.;0.;0.];[0.;0.;0.;0.];[0.;0.;0.;0.]] |> should equal smallM
SparseMatrix.ofColumnList [[0.;0.;0.;0.];[0.;0.;0.;0.];[0.;1.;0.;0.];[0.;0.;0.;0.];[0.;0.;0.;0.];[0.;0.;0.;0.]] |> shouldEqual smallM
[<Test>]
let ``SparseMatrix.ofSeqi`` () =
SparseMatrix.ofSeqi 4 6 (Seq.ofList [(1,2,1.0)]) |> should equal smallM
SparseMatrix.ofSeqi 4 6 (Seq.ofList [(1,2,1.0)]) |> shouldEqual smallM
[<Test>]
let ``SparseMatrix.ofListi`` () =
SparseMatrix.ofListi 4 6 [(1,2,1.0)] |> should equal smallM
SparseMatrix.ofListi 4 6 [(1,2,1.0)] |> shouldEqual smallM
[<Test>]
let ``SparseMatrix.diag`` () =
SparseMatrix.diag 100 2.0 |> should equal (2.0 * (SparseMatrix.identity 100))
SparseMatrix.diag 100 2.0 |> shouldEqual (2.0 * (SparseMatrix.identity 100))
[<Test>]
let ``SparseMatrix.diag2`` () =
SparseMatrix.diag2 100 120 2.0 |> should equal (2.0 * (SparseMatrix.identity2 100 120))
SparseMatrix.diag2 100 120 2.0 |> shouldEqual (2.0 * (SparseMatrix.identity2 100 120))
[<Test>]
let ``SparseMatrix.ofDiag`` () =
SparseMatrix.ofDiag (DenseVector.init 100 (fun i -> 2.0)) |> should equal (2.0 * (SparseMatrix.identity 100))
SparseMatrix.ofDiag (DenseVector.init 100 (fun i -> 2.0)) |> shouldEqual (2.0 * (SparseMatrix.identity 100))
[<Test>]
let ``SparseMatrix.init_row`` () =
SparseMatrix.initRows 4 (fun i -> if i=1 then DenseVector.raw [|0.;0.;1.;0.;0.;0.|] else DenseVector.zero 6) |> should equal smallM
SparseMatrix.initRows 4 (fun i -> if i=1 then DenseVector.raw [|0.;0.;1.;0.;0.;0.|] else DenseVector.zero 6) |> shouldEqual smallM
[<Test>]
let ``SparseMatrix.init_col`` () =
SparseMatrix.initColumns 6 (fun j -> if j=2 then DenseVector.raw [|0.;1.;0.;0.|] else DenseVector.zero 4) |> should equal smallM
SparseMatrix.initColumns 6 (fun j -> if j=2 then DenseVector.raw [|0.;1.;0.;0.|] else DenseVector.zero 4) |> shouldEqual smallM

7
src/FSharpUnitTests/SparseVectorTests.fs

@ -1,7 +1,8 @@
namespace MathNet.Numerics.Tests
open NUnit.Framework
open FsUnit
open FsUnitTyped
open MathNet.Numerics.LinearAlgebra
/// Unit tests for the sparse vector type.
@ -11,7 +12,7 @@ module SparseVectorTests =
let smallv = DenseVector.raw [|0.0;0.3;0.0;0.0;0.0|]
[<Test>]
let ``SparseVector.ofListi`` () = SparseVector.ofListi 5 [ (1,0.3) ] |> should equal smallv
let ``SparseVector.ofListi`` () = SparseVector.ofListi 5 [ (1,0.3) ] |> shouldEqual smallv
[<Test>]
let ``SparseVector.ofSeqi`` () = SparseVector.ofSeqi 5 (List.toSeq [ (1,0.3) ]) |> should equal smallv
let ``SparseVector.ofSeqi`` () = SparseVector.ofSeqi 5 (List.toSeq [ (1,0.3) ]) |> shouldEqual smallv

2
src/FSharpUnitTests/Utilities.fs

@ -8,7 +8,7 @@ open System.Collections.Generic
[<AutoOpen>]
module Utilities =
let test msg b = Assert.IsTrue(b, "MiniTest '" + msg + "'")
let test msg (b:bool) = Assert.IsTrue(b, "MiniTest '" + msg + "'")
let logMessage msg = ()
// System.Console.WriteLine("LOG:" + msg)
// System.Diagnostics.Trace.WriteLine("LOG:" + msg)

64
src/FSharpUnitTests/VectorTests.fs

@ -2,6 +2,8 @@
open NUnit.Framework
open FsUnit
open FsUnitTyped
open MathNet.Numerics.LinearAlgebra
/// Unit tests for the vector type.
@ -20,11 +22,11 @@ module VectorTests =
[<Test>]
let ``Vector.GetSlice`` () =
largev.[*] |> should equal largev
largev.[0..99] |> should equal largev
largev.[1..3] |> should equal (DenseVector.raw [|0.01;0.02;0.03|])
largev.[97..] |> should equal (DenseVector.raw [|0.97;0.98;0.99|])
largev.[..4] |> should equal (DenseVector.raw [|0.00;0.01;0.02;0.03;0.04|])
largev.[*] |> shouldEqual largev
largev.[0..99] |> shouldEqual largev
largev.[1..3] |> shouldEqual (DenseVector.raw [|0.01;0.02;0.03|])
largev.[97..] |> shouldEqual (DenseVector.raw [|0.97;0.98;0.99|])
largev.[..4] |> shouldEqual (DenseVector.raw [|0.00;0.01;0.02;0.03;0.04|])
#if NOFSSLICESET1D
#else
@ -33,120 +35,120 @@ module VectorTests =
let ``Vector.SetSlice`` () =
let v = smallv.Clone() in
v.[*] <- vector [0.1;0.2;0.3;0.4;0.5];
v |> should equal (DenseVector.raw [|0.1;0.2;0.3;0.4;0.5|])
v |> shouldEqual (DenseVector.raw [|0.1;0.2;0.3;0.4;0.5|])
let v = smallv.Clone() in
v.[0..4] <- vector [0.1;0.2;0.3;0.4;0.5];
v |> should equal (DenseVector.raw [|0.1;0.2;0.3;0.4;0.5|])
v |> shouldEqual (DenseVector.raw [|0.1;0.2;0.3;0.4;0.5|])
let v = smallv.Clone() in
v.[1..3] <- vector [7.0;8.0;9.0];
v |> should equal (DenseVector.raw [|0.3;7.0;8.0;9.0;0.3|])
v |> shouldEqual (DenseVector.raw [|0.3;7.0;8.0;9.0;0.3|])
let v = smallv.Clone() in
v.[2..] <- vector [7.0;8.0;9.0];
v |> should equal (DenseVector.raw [|0.3;0.3;7.0;8.0;9.0|])
v |> shouldEqual (DenseVector.raw [|0.3;0.3;7.0;8.0;9.0|])
let v = smallv.Clone() in
v.[..2] <- vector [7.0;8.0;9.0];
v |> should equal (DenseVector.raw [|7.0;8.0;9.0;0.3;0.3|])
v |> shouldEqual (DenseVector.raw [|7.0;8.0;9.0;0.3;0.3|])
#endif
[<Test>]
let ``Vector.toArray`` () =
Vector.toArray smallv |> should equal [|0.3;0.3;0.3;0.3;0.3|]
Vector.toArray smallv |> shouldEqual [|0.3;0.3;0.3;0.3;0.3|]
[<Test>]
let ``Vector.toList`` () =
Vector.toList smallv |> should equal [0.3;0.3;0.3;0.3;0.3]
Vector.toList smallv |> shouldEqual [0.3;0.3;0.3;0.3;0.3]
[<Test>]
let ``Vector.mapInPlace.Dense`` () =
let w = smallv.Clone()
w |> Vector.mapInPlace (fun x -> 2.0 * x)
w |> should equal (2.0 * smallv)
w |> shouldEqual (2.0 * smallv)
[<Test>]
let ``Vector.mapInPlace.Sparse`` () =
let w = sparsev.Clone()
w |> Vector.mapInPlace (fun x -> 2.0 * x)
w |> should equal (2.0 * sparsev)
w |> shouldEqual (2.0 * sparsev)
[<Test>]
let ``Vector.mapSkipZerosInPlace.Sparse`` () =
let w = sparsev.Clone()
w |> Vector.mapSkipZerosInPlace (fun x -> 2.0 * x)
w |> should equal (2.0 * sparsev)
w |> shouldEqual (2.0 * sparsev)
[<Test>]
let ``Vector.mapiInPlace.Dense`` () =
let w = largev.Clone()
w |> Vector.mapiInPlace (fun i x -> float i / 100.0)
w |> should equal (largev)
w |> shouldEqual (largev)
[<Test>]
let ``Vector.mapiInPlace.Sparse`` () =
let w = sparsev.Clone()
w |> Vector.mapiInPlace (fun i x -> 2.0 * float i * x)
w |> should equal (2.0 * sparsev)
w |> shouldEqual (2.0 * sparsev)
[<Test>]
let ``Vector.mapiSkipZerosInPlace.Sparse`` () =
let w = sparsev.Clone()
w |> Vector.mapiSkipZerosInPlace (fun i x -> 2.0 * float i * x)
w |> should equal (2.0 * sparsev)
w |> shouldEqual (2.0 * sparsev)
[<Test>]
let ``Vector.addInPlace`` () =
let w = largev.Clone()
Vector.addInPlace w largev
w |> should equal (2.0 * largev)
w |> shouldEqual (2.0 * largev)
[<Test>]
let ``Vector.subInPlace`` () =
let w = largev.Clone()
Vector.subInPlace w largev
w |> should equal (0.0 * largev)
w |> shouldEqual (0.0 * largev)
[<Test>]
let ``Vector.map`` () =
Vector.map (fun x -> 2.0 * x) largev |> should equal (2.0 * largev)
Vector.map (fun x -> 2.0 * x) largev |> shouldEqual (2.0 * largev)
[<Test>]
let ``Vector.mapSkipZeros`` () =
Vector.mapSkipZeros (fun x -> 2.0 * x) largev |> should equal (2.0 * largev)
Vector.mapSkipZeros (fun x -> 2.0 * x) largev |> shouldEqual (2.0 * largev)
[<Test>]
let ``Vector.mapi`` () =
Vector.mapi (fun i x -> float i / 100.0) largev |> should equal largev
Vector.mapi (fun i x -> float i / 100.0) largev |> shouldEqual largev
[<Test>]
let ``Vector.mapiSkipZeros`` () =
Vector.mapiSkipZeros (fun i x -> float i / 100.0) largev |> should equal largev
Vector.mapiSkipZeros (fun i x -> float i / 100.0) largev |> shouldEqual largev
[<Test>]
let ``Vector.fold`` () =
Vector.fold (fun a b -> a - b) 0.0 smallv |> should equal -1.5
Vector.fold (fun a b -> a - b) 0.0 smallv |> shouldEqual -1.5
[<Test>]
let ``Vector.foldBack`` () =
Vector.foldBack (fun a b -> a - b) 0.0 smallv |> should equal 0.0
Vector.foldBack (fun a b -> a - b) 0.0 smallv |> shouldEqual 0.0
[<Test>]
let ``Vector.foldi`` () =
Vector.foldi (fun i a b -> a + b) 0.0 smallv |> should equal 1.5
Vector.foldi (fun i a b -> a + b) 0.0 smallv |> shouldEqual 1.5
[<Test>]
let ``Vector.forall`` () =
Vector.forall (fun x -> x = 0.3) smallv |> should equal true
Vector.forall (fun x -> x = 0.3) smallv |> shouldEqual true
[<Test>]
let ``Vector.exists`` () =
Vector.exists (fun x -> x = 0.3) smallv |> should equal true
Vector.exists (fun x -> x = 0.3) smallv |> shouldEqual true
[<Test>]
let ``Vector.foralli`` () =
Vector.foralli (fun i x -> x = 0.3 && i < 5) smallv |> should equal true
Vector.foralli (fun i x -> x = 0.3 && i < 5) smallv |> shouldEqual true
[<Test>]
let ``Vector.existsi`` () =
Vector.existsi (fun i x -> x = 0.3 && i = 2) smallv |> should equal true
Vector.existsi (fun i x -> x = 0.3 && i = 2) smallv |> shouldEqual true
[<Test>]
let ``Vector.scan`` () =

5
src/FSharpUnitTests/paket.references

@ -1,3 +1,6 @@
File:FsUnit.fs
File:FsUnitTyped.fs
group Test
FsUnit
NUnit
FSharp.Core

6
src/UnitTests/ArrayHelpers.cs

@ -2,7 +2,9 @@
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// Copyright (c) 2009-2010 Math.NET
//
// Copyright (c) 2009-2016 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
@ -11,8 +13,10 @@
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND

10
src/UnitTests/AssertHelpers.cs

@ -2,7 +2,9 @@
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// Copyright (c) 2009-2010 Math.NET
//
// Copyright (c) 2009-2016 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
@ -11,8 +13,10 @@
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -23,9 +27,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System.Collections.Generic;
using MathNet.Numerics.LinearAlgebra;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests
{

11
src/UnitTests/CombinatoricsTests/CombinatoricsCountingTest.cs

@ -2,7 +2,9 @@
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// Copyright (c) 2009-2010 Math.NET
//
// Copyright (c) 2009-2016 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
@ -11,8 +13,10 @@
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -23,9 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.CombinatoricsTests
{
using NUnit.Framework;
/// <summary>
/// Combinatorics counting tests.

16
src/UnitTests/ComplexTests/Complex32Test.TextHandling.cs

@ -2,7 +2,9 @@
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// Copyright (c) 2009-2010 Math.NET
//
// Copyright (c) 2009-2016 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
@ -11,8 +13,10 @@
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -23,12 +27,14 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Globalization;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.ComplexTests
{
using System;
using System.Globalization;
using NUnit.Framework;
/// <summary>
/// Complex32 text handling tests.
/// </summary>

14
src/UnitTests/ComplexTests/Complex32Test.cs

@ -2,7 +2,9 @@
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// Copyright (c) 2009-2010 Math.NET
//
// Copyright (c) 2009-2016 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
@ -11,8 +13,10 @@
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -23,14 +27,16 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.ComplexTests
{
#if NOSYSNUMERICS
using Complex = Numerics.Complex;
#else
#else
using Complex = System.Numerics.Complex;
#endif
@ -418,7 +424,7 @@ namespace MathNet.Numerics.UnitTests.ComplexTests
}
/// <summary>
/// Can divide without overflow.
/// </summary>
/// </summary>
[Test]
public void CanDodgeOverflowDivision()
{

10
src/UnitTests/ComplexTests/ComplexTest.TextHandling.cs

@ -2,7 +2,9 @@
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// Copyright (c) 2009-2010 Math.NET
//
// Copyright (c) 2009-2016 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
@ -11,8 +13,10 @@
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -23,9 +27,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Globalization;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.ComplexTests
{

10
src/UnitTests/ComplexTests/ComplexTest.cs

@ -2,7 +2,9 @@
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// Copyright (c) 2009-2010 Math.NET
//
// Copyright (c) 2009-2016 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
@ -11,8 +13,10 @@
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -23,7 +27,9 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using NUnit.Framework;
extern alias NUnitFramework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.ComplexTests
{

14
src/UnitTests/DifferentiationTests/FiniteDifferenceCoefficientsTests.cs

@ -2,7 +2,9 @@
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// Copyright (c) 2009-2015 Math.NET
//
// Copyright (c) 2009-2016 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
@ -11,8 +13,10 @@
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -23,11 +27,13 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using MathNet.Numerics.Differentiation;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DifferentiationTests
{
using Differentiation;
using NUnit.Framework;
[TestFixture, Category("Differentiation")]
public class FiniteDifferenceCoefficientsTests
@ -54,7 +60,7 @@ namespace MathNet.Numerics.UnitTests.DifferentiationTests
[Test]
public void ForwardDifferenceThirdOrderEightPointsTest()
{
double[] results = { (double)-967 / 120, (double)638 / 15, (double)-3929 / 40, (double)389 / 3,
double[] results = { (double)-967 / 120, (double)638 / 15, (double)-3929 / 40, (double)389 / 3,
(double)-2545 / 24, (double)268 / 5, (double)-1849 / 120, (double)29 / 15 };
var finite = new FiniteDifferenceCoefficients(8);
var coeff = finite.GetCoefficients(0, 3);

23
src/UnitTests/DifferentiationTests/NumericalDerivativeTests.cs

@ -2,7 +2,9 @@
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// Copyright (c) 2009-2015 Math.NET
//
// Copyright (c) 2009-2016 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
@ -11,8 +13,10 @@
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -23,11 +27,14 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using MathNet.Numerics.Differentiation;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DifferentiationTests
{
using System;
using Differentiation;
using NUnit.Framework;
[TestFixture, Category("Differentiation")]
class NumericalDerivativeTests
@ -88,7 +95,7 @@ namespace MathNet.Numerics.UnitTests.DifferentiationTests
Assert.AreEqual(12, df2(0));
// Original delegate not changed
// Original delegate not changed
Assert.AreEqual(18, df(0));
}
@ -131,7 +138,7 @@ namespace MathNet.Numerics.UnitTests.DifferentiationTests
//Analytical partial dfdy
Func<double[], double> dfdy = (x) => Math.Cos(x[0] * x[1]) * x[0] + 1 / x[0];
// Current value
// Current value
var x1 = new double[] { 3, 3 };
var current = f(x1);
@ -166,7 +173,7 @@ namespace MathNet.Numerics.UnitTests.DifferentiationTests
[Test]
public void VectorFunction1PartialDerivativeTest()
{
Func<double[], double>[] f =
Func<double[], double>[] f =
{
(x) => Math.Pow(x[0],2) - 3*x[1],
(x) => x[1]*x[1] + 2*x[0]*x[1]
@ -184,7 +191,7 @@ namespace MathNet.Numerics.UnitTests.DifferentiationTests
[Test]
public void VectorFunctionMixedPartialDerivativeTest()
{
Func<double[], double>[] f =
Func<double[], double>[] f =
{
(x) => Math.Pow(x[0],2) - 3*x[1],
(x) => x[1]*x[1] + 2*x[0]*x[1]

15
src/UnitTests/DifferentiationTests/NumericalHessianTests.cs

@ -2,7 +2,9 @@
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// Copyright (c) 2009-2015 Math.NET
//
// Copyright (c) 2009-2016 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
@ -11,8 +13,10 @@
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -23,11 +27,14 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using MathNet.Numerics.Differentiation;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DifferentiationTests
{
using System;
using Differentiation;
using NUnit.Framework;
[TestFixture, Category("Differentiation")]
class NumericalHessianTests

19
src/UnitTests/DifferentiationTests/NumericalJacobianTests.cs

@ -2,7 +2,9 @@
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// Copyright (c) 2009-2015 Math.NET
//
// Copyright (c) 2009-2016 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
@ -11,8 +13,10 @@
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@ -23,11 +27,14 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using MathNet.Numerics.Differentiation;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DifferentiationTests
{
using System;
using Differentiation;
using NUnit.Framework;
[TestFixture, Category("Differentiation")]
class NumericalJacobianTests
@ -57,9 +64,9 @@ namespace MathNet.Numerics.UnitTests.DifferentiationTests
[Test]
public void VectorFunctionJacobianTest()
{
Func<double[], double>[] f =
Func<double[], double>[] f =
{
(x) => Math.Pow(x[0], 2)*x[1],
(x) => Math.Pow(x[0], 2)*x[1],
(x) => 5*x[0] + Math.Sin(x[1])
};
var j = new NumericalJacobian();

33
src/UnitTests/DistanceTests.cs

@ -1,4 +1,35 @@
using NUnit.Framework;
// <copyright file="DistanceTests.cs" company="Math.NET">
// Math.NET Numerics, part of the Math.NET Project
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2016 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>
extern alias NUnitFramework;
using NUnitFramework.NUnit.Framework;
using System;
namespace MathNet.Numerics.UnitTests

6
src/UnitTests/DistributionTests/CommonDistributionTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2015 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,13 +27,15 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Distributions;
using MathNet.Numerics.Random;
using MathNet.Numerics.Statistics;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests
{

6
src/UnitTests/DistributionTests/Continuous/BetaScaledTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2015 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,10 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
{

8
src/UnitTests/DistributionTests/Continuous/BetaTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2014 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,10 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
{
@ -355,7 +357,7 @@ namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
AssertHelpers.AlmostEqualRelative(pdfln, n.DensityLn(x), 13);
AssertHelpers.AlmostEqualRelative(pdfln, Beta.PDFLn(a, b, x), 13);
}
[TestCase(0.0, 0.0, 0.0, 0.5)]
[TestCase(0.0, 0.0, 0.5, 0.5)]
[TestCase(0.0, 0.0, 1.0, 1.0)]

6
src/UnitTests/DistributionTests/Continuous/CauchyTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2014 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,10 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
{

6
src/UnitTests/DistributionTests/Continuous/ChiSquareTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2014 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,10 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
{

6
src/UnitTests/DistributionTests/Continuous/ChiTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2014 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,10 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
{

6
src/UnitTests/DistributionTests/Continuous/ContinuousUniformTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2014 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,10 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
{

6
src/UnitTests/DistributionTests/Continuous/ErlangTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2014 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,10 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
{

6
src/UnitTests/DistributionTests/Continuous/ExponentialTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2014 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,10 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
{

6
src/UnitTests/DistributionTests/Continuous/FisherSnedecorTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2014 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,10 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
{

6
src/UnitTests/DistributionTests/Continuous/GammaTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2014 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,10 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
{

6
src/UnitTests/DistributionTests/Continuous/InverseGammaTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2014 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,10 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
{

6
src/UnitTests/DistributionTests/Continuous/LaplaceTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2014 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,10 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
{

6
src/UnitTests/DistributionTests/Continuous/LogNormalTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2014 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,10 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
{

6
src/UnitTests/DistributionTests/Continuous/NormalTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2014 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,10 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
{

6
src/UnitTests/DistributionTests/Continuous/ParetoTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2014 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,10 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
{

6
src/UnitTests/DistributionTests/Continuous/RayleighTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2014 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,10 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
{

6
src/UnitTests/DistributionTests/Continuous/StableTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2014 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,10 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
{

6
src/UnitTests/DistributionTests/Continuous/StudentTTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2014 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,10 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
{

14
src/UnitTests/DistributionTests/Continuous/TriangularTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2014 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,10 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
{
@ -91,11 +93,11 @@ namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
var n = new Triangular(0d, 2d, 1d);
Assert.AreEqual("Triangular(Lower = 0, Upper = 2, Mode = 1)", n.ToString());
}
// Todo: Add tests for:
// - Mean,
// - Entropy,
// - Skewness,
// - Mean,
// - Entropy,
// - Skewness,
// - Mode (note: Mode is an input parameter for this distribution),
// - Median
// - Minimum (should be the same as LowerBound)

6
src/UnitTests/DistributionTests/Continuous/WeibullTests.cs

@ -3,7 +3,7 @@
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
//
// Copyright (c) 2009-2014 Math.NET
// Copyright (c) 2009-2016 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -27,10 +27,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
extern alias NUnitFramework;
using System;
using System.Linq;
using MathNet.Numerics.Distributions;
using NUnit.Framework;
using NUnitFramework.NUnit.Framework;
namespace MathNet.Numerics.UnitTests.DistributionTests.Continuous
{

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

Loading…
Cancel
Save