Java matrix libraries

2019-01-07 10:27发布

I was wondering whether any of the well-known matrix libraries for Java, such as Colt or EJML, actually provide similar functionality as MatLab? For instance, I can't seem to find anywhere in the definition of their API simple method to add or subtract two matrices/vectors by each other, which seems to be the most common operation used. Am I missing something?

标签: java matrix colt
5条回答
做个烂人
2楼-- · 2019-01-07 11:14

The interface for COLT gives you a generic OP: assign(matrix, function), which you can use to add or subtract matrices and vectors.

As the javadocs for assign() says:

Assigns the result of a function to each cell; x[row,col] =function(x[row,col],y[row,col]).

So by using using an addition function as function - you can add matrices.

查看更多
ゆ 、 Hurt°
3楼-- · 2019-01-07 11:17

Try Apache Commons Math library. org.apache.commons.math3.linear package contains the functions that you want. Home page

查看更多
太酷不给撩
4楼-- · 2019-01-07 11:17

You can use this one. It is very siple and supply basic matrix operations.

You can add/substract/multiply etc 2d matrixes and vectors.

查看更多
贼婆χ
5楼-- · 2019-01-07 11:19

Some Java libraries for linear algebra are:

EDIT maybe we can extend this list whenever one comes across and you know - the world keeps moving:

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

查看更多
手持菜刀,她持情操
6楼-- · 2019-01-07 11:23

There is also la4j library that supports functional programming features as functors. You can use transform() method with manual hi-order function.

查看更多
登录 后发表回答