This project has moved. For the latest updates, please go here.

Getting Math.Net Numerics to work

Apr 12, 2011 at 2:55 PM

Hi there,

I have started to setup a project in Visual Studio 2010 C# which uses Math.Net Numerics. I want to do some FFT with it.

To use System.Numerics.Complex I have manually added a reference to System.Numerics.dll

 

When I compile the code below I get an error which tells me to add a reference to  "System.Numerics, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

I can not understand the problem. The System.Numerics I use has version 4.0.0.0 and runtime version v4.0.30319.

 

How can I make it work?

 

Many thanks

 

Sascha

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
// using System.Numerics;
using MathNet.Numerics;
using MathNet.Numerics.IntegralTransforms;

namespace adeeval
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btFFT_Click(object sender, EventArgs e)
        {
            System.Numerics.Complex[] inFFT = new System.Numerics.Complex[5];

            for (int i = 0; i < 5; i++)
            {
                inFFT[i] = new System.Numerics.Complex(1, 0);
            }

            Transform.FourierForward(inFFT, FourierOptions.Matlab);   
        }
    }
}

Apr 13, 2011 at 2:17 PM

Hi Sascha,

This is very odd. Doing a quick web search it seems that System.Numercs 2.0.5.0 was used in a older version of the DLR (and maybe Silverlight 3). Could you try creating a .NET 4.0 WinForm project from scratch and see if the problem still occurs?

Thanks,

Marcus

Apr 13, 2011 at 2:31 PM

Hi Marcus,

finally I solved the problem. When adding the reference of Math.NET to my Visual Studio 2010 project I think I made the mistake to set it to the dll in the SL4 subfolder and not to the one in the Net40 subfolder.

Upon my first trial something (which I don't remember' went wrong with the Net40 version so I changed the reference and didn't think about this change anymore.

Now it works and as far as I can see Math.Net does a great job!

 

Thank you

 

Sascha