简体   繁体   English

java稀疏矩阵问题

[英]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 improve my program performance. 请问任何正文可以回答我在java中可以使用的api或类来处理稀疏矩阵以提高我的程序性能。

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. 看看Colt线性代数库。


Another possibility for sparse linear algebra is the apache commons library. 稀疏线性代数的另一种可能性是apache commons库。 Might be a little lighter-weight than Colt but the difference from the look-and-feel of Jama might be a little larger. 可能比Colt轻一点,但与Jama的外观和感觉的差异可能会略大一些。

SuanShu has a large collection of sparse matrices implemented. SuanShu实现了大量稀疏矩阵。 You can simply use those instead writing your own. 你可以简单地使用它们而不是自己编写。

They currently support these formats: CSR, DOK, LIL 他们目前支持以下格式:CSR,DOK,LIL

You might look at la4j (Linear Algebra for Java). 您可以查看la4j (线性代数for Java)。 The la4j supports sparse matrices as well as dense ones. la4j支持稀疏矩阵和密集矩阵。 Here is the list of supported matrix types: 1D-Array (dense), 2D-Array (dense), CRS - Compressed Row Storage (sparse), CCS - Compressed Column Storage (sparse). 以下是支持的矩阵类型列表:1D阵列(密集),2D阵列(密集),CRS - 压缩行存储(稀疏),CCS - 压缩列存储(稀疏)。

Have you tried using Jama? 你尝试过使用Jama吗? http://math.nist.gov/javanumerics/jama/ - they don't directly support sparse matrices, but it's a widely used package. http://math.nist.gov/javanumerics/jama/ - 它们不直接支持稀疏矩阵,但它是一个广泛使用的包。

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 此外,princeton似乎有一个稀疏矩阵实现,你可以看看http://www.cs.princeton.edu/introcs/44st/SparseMatrix.java.html

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

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