Latest Updates
Latest Tweets
Fork me on GitHub

Basic Concepts

Math.Net Numerics is an open souce .NET library for numerical computation. The library was built by merging the feature sets of the dnAnalytics and Math.Net Iridium projects. In this user guide, we will explore the basic architecture of Math.Net Numerics and give an overview of the features it supports.

Quality Assurance

We aim to make Math.Net a very high quality numerical library; to do so we set a very high standard on fixing bugs fast (generally within 24 to 48 hours). If you run across any issues with the library, please report them to our issue tracker. That being said, our library does not come with any warranty, it is provided "as is". Contact any of the main developers if you have any questions regarding using Math.Net in your project.

Architecture

The Math.Net architecture is illustrated in the diagram below. The core of Math.Net Numerics is a managed front-end API that provides a set of numerical procedures. Documentation for this API can be found TODO here. On top of the front-end API is an F# specific API which introduces a number of methods to help functional programmers use Math.Net.

Architecture.png
Math.Net implements two different kinds of back-ends: a managed and a native backend. Although both the managed and the native backend have functionality implemented in managed code (C# actually), the native backend offers faster implementation of some numerical routines (mostly numerical linear algebra). The native back-ends are implemented in a mix of C, C and optimized assembler and hence cannot be used in managed only environments. The currently offered native back-ends are based on the ATLAS/LAPACK implementation and the Intel MKL libraries.

All of the managed code requires .NET 4.0.

Parallelism and Thread Safety

Math.Net uses the parallelism features introduces in .NET 4.0 for improving it's performance. Particularly in the linear algebra classes, there are many operations which are parallelized. To turn off parallelism, one can set

MathNet.Numerics.Control.DisableParallelization = true;
To control the number of threads which Math.Net uses for parallelism one can set
// The number of worker threads we want to use.
int n = 4;
// Set the number of threads Math.Net can use.
MathNet.Numerics.Control.NumberOfParallelWorkerThreads = n;
By default the standard Math.Net release uses the number of processors as the number of worker threads whereas the Silverlight version of Math.Net defaults to one thread.

Generally, the methods and classes in Math.Net do not perform locking for thread safety. For some classes this can be enabled/disabled. The random number generators are thread safe by default but this can be switched off by setting

MathNet.Numerics.Control.DisableParallelization = true;