我想知道是否有任何知名的矩阵库为Java,如柯尔特或EJML的,实际上提供了类似的功能MatLab的? 举例来说,我似乎无法在他们的API简单的方法的定义中对方,这似乎是最常用的操作,增加或减去两个矩阵/矢量任何地方。 我缺少的东西吗?
Answer 1:
尝试阿帕奇共享数学库。 org.apache.commons.math3.linear包中包含所需的功能。 主页
Answer 2:
Some Java libraries for linear algebra are:
- Apache Commons Math: http://commons.apache.org/proper/commons-math/
- jeigen - a wrapper for eigen - https://github.com/hughperkins/jeigen (includes complex and rarely found feature like matrix exponential and matrix logarithm)
- jblas http://mikiobraun.github.io/jblas/ (also features more complex functions like matrix exponential, also very fast).
- Colt http://acs.lbl.gov/software/colt/
- JAMA http://math.nist.gov/javanumerics/jama/
- UJMP - http://sourceforge.net/projects/ujmp/
EDIT maybe we can extend this list whenever one comes across and you know - the world keeps moving:
- ojAlgo - http://ojalgo.org/ has promising benchmarks
- Efficient Java Matrix Library (EJML) - http://ejml.org
- ParallelColt - https://sites.google.com/site/piotrwendykier/software/parallelcolt
- la4j - http://la4j.org/
- MTJ - https://github.com/fommil/matrix-toolkits-java
- nd4j - https://nd4j.org/ lets you choose underlying native implementations like cuda or openBlas
Note: Personally: I use Apache Commons Math and Colt in my own project (http://www.finmath.net). While commons math is actively developed, I found that Colt is still faster in some tasks (like Eigenvalue decomposition). For that reason I use some kind of wrapper which allows me to quickly switch the underlying library (I only need a few things like solving systems of equations and Eigenvalue decomposition).
Answer 3:
对于COLT接口给你的通用OP: assign(matrix, function)
,它可用来添加或减去矩阵和向量。
由于Javadoc文档assign()
说:
分配的功能到每个单元的结果;
x[row,col] =function(x[row,col],y[row,col])
因此,通过使用加功能使用function
-您可以添加矩阵。
Answer 4:
还有la4j支持的函数编程功能的仿函数库。 您可以使用变换()方法手动喜阶功能。
Answer 5:
您可以使用这一个 。 这是非常简单,提供基本的矩阵运算。
您可以添加/。减去/乘等二维矩阵,向量。