java sparse matrix problem

血红的双手。 提交于 2019-12-22 08:38:48

问题


I have two dimensional matrix. My matrix is sparse. I am facing performance problem. Can any body please answer that what api or class i can use in java to handle sparse matrix to improve my program performance.

For example I want

it take 100x100 matrix
handle sparse stuff
do the multiplication
return me my matrix same as 100x100 with 0 ( mean sparse matrix )

回答1:


Jama is awful for large sparse matrices.

Have a look at the Colt linear algebra library.


Another possibility for sparse linear algebra is the apache commons library. Might be a little lighter-weight than Colt but the difference from the look-and-feel of Jama might be a little larger.




回答2:


You might look at la4j (Linear Algebra for Java). The la4j supports sparse matrices as well as dense ones. Here is the list of supported matrix types: 1D-Array (dense), 2D-Array (dense), CRS - Compressed Row Storage (sparse), CCS - Compressed Column Storage (sparse).




回答3:


SuanShu has a large collection of sparse matrices implemented. You can simply use those instead writing your own.

They currently support these formats: CSR, DOK, LIL




回答4:


Have you tried using Jama? http://math.nist.gov/javanumerics/jama/ - they don't directly support sparse matrices, but it's a widely used package.

Also, princeton seems to have a sparse matrix implementation for you to take a look at http://www.cs.princeton.edu/introcs/44st/SparseMatrix.java.html



来源:https://stackoverflow.com/questions/2313135/java-sparse-matrix-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!