java稀疏矩阵问题
我有二维矩阵。我的矩阵是稀疏的。我面临性能问题。任何人都可以回答我可以在java中使用什么api或类来处理稀疏矩阵以提高我的程序性能。
例如我想要
it take 100x100 matrix
handle sparse stuff
do the multiplication
return me my matrix same as 100x100 with 0 ( mean sparse matrix )
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 )
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Jama 对于大型稀疏矩阵来说非常糟糕。
查看 Colt 线性代数库。
稀疏线性代数的另一种可能性是 apache公共图书馆。可能比 Colt 重量轻一些,但与 Jama 的外观和感觉的差异可能更大一些。
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.
您可以查看 la4j(Java 线性代数)。 la4j 支持稀疏矩阵和稠密矩阵。以下是支持的矩阵类型列表:1D 数组(密集)、2D 数组(密集)、CRS - 压缩行存储(稀疏)、CCS - 压缩列存储(稀疏)。
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).
算数 实现了大量稀疏矩阵。您可以简单地使用它们,而不是编写自己的。
他们目前支持以下格式:CSR、DOK、LIL
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
您尝试过使用 Jama 吗? http://math.nist.gov/javanumerics/jama/ - 他们没有直接支持稀疏矩阵,但它是一个广泛使用的包。
另外,普林斯顿似乎有一个稀疏矩阵实现供您查看 http://www.cs.princeton.edu/introcs/44st/SparseMatrix.java.html
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