简体   繁体   English

大型稀疏矩阵计算-MathNet数值

[英]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. 我开始使用MathNet数值库 ,我需要它来计算与邻接矩阵的特征向量相对应的最大特征值。

When using large amount of points my adjacency Matrix gets quite big (ie 5782x5782 entries) 当使用大量点时,邻接矩阵会变得非常大(即5782x5782条目)

Most of the entries are '0' so I thought I could use the 'SparseMatrix'. 大多数条目为“ 0”,所以我认为我可以使用“ 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中尝试了整个过程,没有任何问题。 Matlab solved it within a few seconds. Matlab在几秒钟内解决了它。

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. Math.Net Numerics的实现完全基于C#。 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. 因此,性能可能无法与MATLAB之类的工具相提并论,因为它们主要依赖于本机且经过高度优化的BLAS库来执行数值计算。

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). 您可能要使用Math.Net随附的本机包装,这些包装使用了高度优化的线性代数库(例如Intel的MKL或AMD的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 ). 这个MSDN页面上有一个指南,说明了如何构建具有ACML支持的Math.NET(请参见Math.NET Numerics中的“编译和使用AMD ACML” )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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