CodePlexProject Hosting for Open Source Software

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.

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 Control.ThreadSafeRandomNumberGenerators = false;

One has to be very careful when using the distributions. There are many ways to parameterize one distribution in the literature; when using the default constructor, study carefully which parameters it requires. If they do not suite your needs, there will very likely be static method which can construct the distribution for you. E.g. var n = new Normal(0.0, 2.0); constructs a normal distribution with mean 0.0 and standard deviation 2.0. If you'd rather parameterize the normal distribution using a mean and precision, one can use the following code var n = Normal.WithMeanPrecision(0.0,0.25); .

All the distributions implement a basic set of operations such as computing the mean, standard deviation, density, etc. Note that it is often much faster to compute quantities in the log domain; for some quantities (e.g. Density) we implement an equivalent method that does all computations in the log domain (e.g. DensityLn).

Each distribution provides methods to generate random numbers from that distribution. These random variate generators work by accessing the distribution's member RandomSource (which is a subclass of System.Random , see below) to provide uniform random numbers. By default, this member is an instance of System.Random but one can easily replace this with more sophisticated random number generators from MathNet.Numerics.Random. Each distribution class has two static and two class methods: for each pair (static and class), one of them generates a single sample, the other will generate an IEnumerable<T> of samples. The static methods allow random number generation without instantiating the actual class.

Last edited May 6, 2010 at 9:08 AM by cdrnet, version 14