Matlab vs Java

This SUCKS balls! I was at school today, trying to run my NMF algorithm on a 4MB image file. I started running the test around 12pm – it was chugging along happily as I was working on my Programming Languages homework (which is crazy btw).

I left at 6, and my program was still running. That’s 6 hours and counting. What’s funny is that Dr. Robila implemented the same algo in Matlab and it processed the very same image in under 5 minutes. Aaaagh!

Of course you need to take into consideration that in Matlab matrix multiplication, or a transpose is accomplished with a single operator. This means that there are years of tweaking, and anal optimization behind each of these. I’m doing all of this using loops, and my data is stored in Java’s DataBuffers. This means that every access is a function call.

I’m thinking about optimizing this using arrays. I will have to look into how much faster is it to access an element of a multidimensional array, as opposed to accessing an element of a DataBuffer. Perhaps it is not even worth bothering, as Java arrays are sort-of-objects anyway.

If that damn JDS machine freezes before finishing this 6+ hour run, I will take a fucking baseball bat to it or something :P I better see some results tomorrow!

This entry was posted in programming and tagged . Bookmark the permalink.



3 Responses to Matlab vs Java

  1. Holger GERMANY Mozilla Firefox Windows says:

    Have you tried using one of the matrix libraries for Java? JAMA and Colt are not very fast, but ojAlgo, EJML, UJMP and Parallel Colt have good performance for matrix multiplication and transpose.

    Hope this helps!

    Reply  |  Quote
  2. pako MEXICO Mozilla Firefox Windows says:

    man MATLAB is best thing in the planet i love matlab

    Reply  |  Quote
  3. Zloy COLOMBIA Google Chrome Windows says:

    Have you tried JAMA? or octave or scilab? in case matlab is too expensive… Right now I’m actually trying to do a NMF by multiplicative updates to a 2500 x 1000 matrix using JAMA, I just have a little problem I’m trying to solve.

    Reply  |  Quote

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>