UJMP Java library for sparse matrix

倾然丶 夕夏残阳落幕 提交于 2019-12-11 05:06:48

问题


I have downloaded and included UJMP (Universal Java Matrix Package) library to my project for generating sparse matrix. But I could not find any documentation about functions of the library, how to create a sparse matrix, adding element to matrix etc. Is there anyone experienced about it or have a documentation about the library? Thank you for all.


回答1:


There is a la4j library that supports sparse matrices and vectors. Follow the examples given at official site. la4j supports CRS (Compressed Row Storage) as well as CCS (Compressed Column Storage) for sparse matrices. More importantly, the its actually taking the advantages from sparse data in computations due to easy-to-use composable iterators. For example, multiplication of two sparse matrices of shape 10k x 10k with just 1% of non-zero values will take a few microseconds on a modern laptop.

Here is the example:

Matrix a = CRSMatrix.random(10000, 10000, 0.25 /* density */, new Random());
Matrix b = CCSMatrix.random(10000, 10000, 0.25 /* density */, new Random());
Matrix c = a.multiply(b);

The la4j is actively developed. The current version 0.5.0 has released in Jan 2015.



来源:https://stackoverflow.com/questions/13207762/ujmp-java-library-for-sparse-matrix

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