Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Math.NET Numerics
C# F# Other
Pull request Compare This branch is 1 commit ahead, 188 commits behind mathnet:master.
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
src LA: vector array functional and statistical routines
.editorconfig Convert F# examples to F# scripts (interactive); update nuget
.gitignore Docs: start migrating links from numerics homepage to docs; doc gener…
.travis.yml Docs: tweak build & tools docs, merge into website
Examples.sln Fix examples
Math.Net Master Slides.pptx Added slides on Math.Net which can be used for documentation and pres…
MathNet.Numerics.Data.sln.DotSettings Data: Matlab: simplify names
MathNet.Numerics.Net35Only.sln Build: .Net 3.5 support for F# extensions #243
MathNet.Numerics.Portable.sln.DotSettings Meta: update Vagrantfile, DotSettings, git attributes
MathNet.Numerics.sln.DotSettings Added MKL memory functions
NativeProviders.txt updated ACML instructions
Performance.sln Release v3.5.0
Vagrantfile Vagrant: now with official Ubuntu 14.04 LTS; mono/fsharp apt-provisio…

Math.NET Numerics

Math.NET Numerics is an opensource numerical library for .Net, Silverlight and Mono.

Math.NET Numerics is the numerical foundation of the Math.NET initiative, aiming to provide methods and algorithms for numerical computations in science, engineering and every day use. Covered topics include special functions, linear algebra, probability models, random numbers, statistics, interpolation, integration, regression, curve fitting, integral transforms (FFT) and more.

In addition to the core .NET package (which is written entirely in C#), Numerics specifically supports F# with idiomatic extension modules and maintains mathematical data structures like BigRational that originated in the F# PowerPack. If a performance boost is needed, the managed-code provider backing its linear algebra routines and decompositions can be exchanged with wrappers for optimized native implementations such as Intel MKL.

Math.NET Numerics is covered under the terms of the MIT/X11 license. You may therefore link to it and use it in both opensource and proprietary software projects. We accept contributions!

Current Version

Math.NET Numerics Version Math.NET Numerics
Native Providers Version Native Providers
Data Extensions Version Data Extensions

Installation Instructions

The recommended way to get Math.NET Numerics is to use NuGet. The following packages are provided and maintained in the public NuGet Gallery. Alternatively you can also download the binaries in Zip packages, available on CodePlex.

Core Package:

  • MathNet.Numerics - core package, including .Net 4, .Net 3.5 and portable/PCL builds.
  • MathNet.Numerics.FSharp - optional extensions for a better F# experience. BigRational.
  • MathNet.Numerics.Signed - strong-named version of the core package (not recommended).
  • MathNet.Numerics.FSharp.Signed - strong-named version of the F# package (not recommended).

Alternative Provider Packages (optional):

  • MathNet.Numerics.MKL.Win-x86 - Native Intel MKL Linear Algebra provider (Windows/32-bit).
  • MathNet.Numerics.MKL.Win-x64 - Native Intel MKL Linear Algebra provider (Windows/64-bit).

Data/IO Packages for reading and writing data (optional):

  • MathNet.Numerics.Data.Text - Text-based matrix formats like CSV and MatrixMarket.
  • MathNet.Numerics.Data.Matlab - MATLAB Level-5 matrix file format.

Platform Support and Dependencies

Supported Platforms:

  • .Net 4.0, .Net 3.5 and Mono: Windows, Linux and Mac.
  • PCL Portable Profiles 7, 47, 78, 259 and 328: Windows 8, Silverlight 5, Windows Phone/SL 8, Windows Phone 8.1.
  • Xamarin: Android, iOS

The F# extensions support a slightly reduced platform set:

  • .Net 4.0, .Net 3.5 and Mono: Windows, Linux and Mac.
  • PCL Portable Profile 47: Windows 8, Silverlight 5
  • Xamarin: Android, iOS

Package Dependencies:

Framework Dependencies (part of the .NET Framework):

  • .Net 4.0 and higher, Mono, PCL profiles 7 and 47: System.Numerics
  • .Net 3.5, PCL profiles 78, 259 and 328: None

Platform Discrepancies

Compilation symbols used to deal with platform differences:

  • NET35 - Some framework attributes are not available and we provide our own Tuple types, generic comparer, LINQ Zip routine and thread partitioner. The crypto random source is not disposable.
  • PORTABLE - Some framework attributes are not available and we provide our own parallelization routines and partitioning using TPL Tasks. Reduced globalization and serialization support. Work around some missing routines like Math.DivRem, Array.FindIndex and BitConverter. There is no ICloneable. The crypto random source is not available; simpler random seeding.
  • NOSYSNUMERICS - The System.Numerics framework assembly is not available. We provide our own double-precision complex number type and disable all arbitrary precision numbers support (BigInteger, BigRational).
  • NET45REFLECTION - we use the new .Net 4.5 reflection API where type information is split into Type and TypeInfo.
  • NATIVEMKL - we can support the Intel MKL native provider.
Configuration Net35 Portable NoSysNumerics Net45Reflection NativeMKL
.Net 4.0 - - - - Yes
.Net 3.5 Yes - Yes - -
Portable 7 - Yes - Yes -
Portable 47 - Yes - - -
Portable 78 - Yes Yes Yes -
Portable 259 - Yes Yes Yes -
Portable 328 - Yes Yes - -

Compatibility Matrix:

Configuration Net35 Net40 Net45 SL5 Win8 WP8/SL WP8.1 Xamarin
.Net 4.0 - Best Best - - - - -
.Net 3.5 Best OK OK - - - - -
Portable 7 - - OK - Best - - OK
Portable 47 - - OK Best OK - - OK
Portable 78 - - OK - OK Best - OK
Portable 259 - - OK - OK OK Best OK
Portable 328 - OK OK OK OK OK OK OK

Building Math.NET Numerics

Windows (.Net): AppVeyor build status
Linux (Mono): Travis Build Status

If you do not want to use the official binaries, or if you like to modify, debug or contribute, you can compile Math.NET Numerics locally either using Visual Studio or manually with the build scripts.

  • The Visual Studio solutions should build out of the box, without any preparation steps or package restores.
  • Instead of a compatible IDE you can also build the solutions with msbuild, or on Mono with xbuild.
  • The full build including unit tests, docs, NuGet and Zip packages is using FAKE.

How to build with MSBuild/XBuild

msbuild MathNet.Numerics.sln            # only build for .Net 4 (main solution)
msbuild MathNet.Numerics.Net35Only.sln  # only build for .Net 3.5
msbuild MathNet.Numerics.All.sln        # full build with .Net 4, 3.5 and PCL profiles
xbuild MathNet.Numerics.sln             # build with Mono, e.g. on Linux or Mac

How to build with FAKE

build.cmd    # normal build (.Net 4.0), run unit tests (.Net on Windows)
./   # normal build (.Net 4.0), run unit tests (Mono on Linux/Mac, .Net on Windows)

build.cmd Build              # normal build (.Net 4.0)
build.cmd Build incremental  # normal build, incremental (.Net 4.0)
build.cmd Build all          # full build (.Net 4.0, 3.5, PCL)
build.cmd Build net35        # compatibility build (.Net 3.5)
build.cmd Build signed       # normal build, signed/strong named (.Net 4.0)

build.cmd Test        # normal build (.Net 4.0), run unit tests
build.cmd Test quick  # normal build (.Net 4.0), run unit tests except long running ones
build.cmd Test all    # full build (.Net 4.0, 3.5, PCL), run all unit tests
build.cmd Test net35  # compatibility build (.Net 3.5), run unit testss

build.cmd Clean  # cleanup build artifacts
build.cmd Docs   # generate documentation
build.cmd Api    # generate api reference

build.cmd NuGet all     # generate normal NuGet packages (.Net 4.0, 3.5, PCL)
build.cmd NuGet signed  # generate signed/strong named NuGet packages (.Net 4.0)

build.cmd NativeBuild      # build native providers for all platforms
build.cmd NativeTest       # test native providers for all platforms

build.cmd All          # build, test, docs, api reference (.Net 4.0)
build.cmd All release  # release build

FAKE itself is not included in the repository but it will download and bootstrap itself automatically when build.cmd is run the first time. Note that this step is not required when using Visual Studio or msbuild directly.

Something went wrong with that request. Please try again.