I'm using ejml library for writing mathematical algorithms in java. I think it is pretty useful, but I need to know if there is a fast mode (like print()) to print a matrix with indexes. Example:
1 2
1 0.00 0.01
2 0.03 0.54
3 3.45 7.88
4 2.24 5.66
Otherwise, do you know other libraries aimed at the purpose?
Take a look at
MatrixIOclass. It has over 10 differentprint(...)methods, for all kinds of matrices. Altough there are no indices will be printed you can override needed methods at your wish.On the other hand, custom implementation should be fairly simple algorithm. Some generic method which accepts all kinds of matrices should be sufficient.
Here's a working example with comments:
Code
Output
It's far from being perfect. Formatting will break for large values, but it should give you a good start.
GitHub Gist: https://gist.github.com/MSBlastt/7c4f3e25b8bed74fac90b6e0ef2f8e7a