开发者

java sparse matrix problem

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 improv开发者_如何学Ce 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 )


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.


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).


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜