简体   繁体   中英

Large Sparse Matrix Calculation - MathNet Numerics

I started using the MathNet Numerics Library and I need it to calculate the largest Eigenvalues corresponding to their Eigenvectors of my adjacency matrix.

When using large amount of points my adjacency Matrix gets quite big (ie 5782x5782 entries)

Most of the entries are '0' so I thought I could use the 'SparseMatrix'. But when I use it, it still takes ages for computation. In fact I never really waited that long until its finished. I tried the whole thing in matlab and there wasn't any problem at all. Matlab solved it within a few seconds.

Do you have any suggestions for me?

Here is what I'm doing:

// initialize matrix and fill it with zeros
Matrix<double> A = SparseMatrix.Create(count, count, 0);

... fill matrix with values ...

// get eigenvalues and eigenvectors / this part takes centuries =)
Evd<double> eigen = A.Evd(Symmetricity.Symmetric);
Vector<Complex> eigenvector = eigen.EigenValues;

Math.Net Numerics's implementation is purely C# based. Therefore, performance may not be on-par with tools such as MATLAB since they mostly rely on native and highly optimized BLAS libraries for performing numerical computations.

You may want to use the native wrappers that come with Math.Net that leverage highly optimized linear algebra libraries (such as Intel's MKL or AMD's ACML). There is a guide on this MSDN page that explains how to build Math.NET with ACML support (look under Compiling and Using AMD ACML in Math.NET Numerics ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM