Matrix manipulation



Hi, I’m writing a plugin for Imagej2 which is my first one, and I require a bit of matrix manipulation, I mean, reshaping, transpose and SVD for example of many small submatrices. So I’d like to know which libraries do you recommend nowadays. I need to repeat the same operations in different parts of an image. Sorry if it is not a valid question.

My first attempt was to use JBlas since I had read it was one of the fastest libraries. However, each operation requires copying the entire matrix for most of the operations I need. Then I changed the whole computation part to ND4J gaining twice the speed with practically the same operations. The only difference is that ND4J allows accessing to submatrices and other operations in place and without copying them.

I was really happy until I realize I required a lot of dependencies for making it work on FIJI; and I would like people to use it without so many requirements. Now I’m thinking about trying EJML but I don’t know if it worth it. I didn’t try JAMA since most comments about it were from a few years ago, but maybe I should try it too.

Best regards


Hi @sebsacuna,

Welcome to the forum.

I’ve had good experiences with ejml (bigwarp uses it). ojalgo is another good option, but the details depend on exactly what you want to do.

Both come packaged with Fiji, btw.

This benchmark is old, but might be of interest to you. Conclusion: stay away from JAMA



I didn’t realized they both were already in FIJI, my bad, I could have saved a lot of time leading with dependencies. Thank you so much! I will try them both I think.

Best regards