问题
Is there any sparse matrix library that can do these:
- solve linear algebraic equations
- support operations like matrix-matrix/number multiplication/addition/subtraction,matrix transposition, get a row/column of a matrix,and so on
- matrix size could be 40k*40k or bigger,like 250k*250k
- fast
- can be used in Windows
Can someone recommend some libraries for me? If you recommend, please tell me the advantages and disadvantages of it, and the reason why you recommend it.
By the way,I have searched many sparse matrix libraries on the internet and tested some of them. I found that each of them only supported very few operations(many of them can only solve linear algebraic equations and do matrix-vector multiplication) .Finally I found one named SparseLib++. It didn't support many operations, either.So I added a lot of basic matrix operations. Now it works. However, I just heard that SparseLib++ was too old and not fast. But my project is based on SparseLib++ and I have spent a lot of work on SparseLib++. So I am wondering whether to try another sparse matrix library or not.
回答1:
http://www.mcs.anl.gov/petsc/ has a lot of built in linear algebra and ca distribute matrices over a cluster when your data gets big. There's also an active following on https://scicomp.stackexchange.com/ when you have technical questions. The downside is that the learning curve is a bit steep.
回答2:
Can someone recommend some libraries for me?
A quite detailed list with comparisons
Recommendations for a usable, fast C++ matrix library?
What are the most widely used C++ vector/matrix math/linear algebra libraries, and their cost and benefit tradeoffs?
If you recommend, please tell me the advantages and disadvantages of it, and the reason why you recommend it.
When it comes to large-scale sparse stuff, I personally use the Harwell Subroutine library. It's written in Fortran and it is a pain to interface it with C++. Nevertheless, I use it because it is robust and fast.
回答3:
Boost would be a good place to start. The libraries are free, well supported, well documented, fast and portable.
回答4:
Eigen library has good support for spars matrix manipulation, and the most appealing feature is that its style is like Matlab.
来源:https://stackoverflow.com/questions/17241227/sparse-matrix-library-for-c