
I'm writing a code where I'm performing matrix multiplication of 2000x3 into 3x3 matrices a whole lot of times (5000!). The same code in matlab takes less than a 1 sec to run but using Math.Net in C# it took me over a minute.
Is there anyway to speed up the matrix multiplication performance with Math.net?
Thanks,
Nishant


Coordinator
Aug 30, 2012 at 5:57 PM

Yes, that takes ~20 secs on my notebook as well (default settings hence parallelization enabled). What you can do is:
 Disable parallelization and parallelize yourself (i.e. compute the 5000 products in parallel, but each product itself on a single thread only), this is a bit faster on my machine:
Control.DisableParallelization = true;
Parallel.ForEach(x, x => { x.res = x.a * x.b });
 Or use a native provider, see
Native Linear Algebra Providers. This should be much faster, comparable to Matlab.

