4

我有二维矩阵。我的矩阵很稀疏。我正面临性能问题。任何人都可以回答我可以在java中使用什么api或类来处理稀疏矩阵以提高我的程序性能。

例如我想要

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

4 回答 4

6

Jama 对于大型稀疏矩阵来说很糟糕。

看看Colt线性代数库。


稀疏线性代数的另一种可能性是apache commons library。可能比 Colt 轻一点,但与 Jama 的外观和感觉的差异可能会更大一些。

于 2010-02-22T18:32:33.530 回答
1

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

于 2013-02-11T04:14:29.530 回答
1

SuanShu实现了大量的稀疏矩阵。你可以简单地使用那些而不是编写你自己的。

他们目前支持以下格式:CSR、DOK、LI​​L

于 2011-01-08T11:37:48.013 回答
0

你试过使用 Jama 吗?http://math.nist.gov/javanumerics/jama/ - 它们不直接支持稀疏矩阵,但它是一个广泛使用的包。

此外,princeton 似乎有一个稀疏矩阵实现供您查看http://www.cs.princeton.edu/introcs/44st/SparseMatrix.java.html

于 2010-02-22T18:29:01.000 回答