scalala / Scalala

Scalala has been superseded by dlwh/breeze. Scalala is a high performance numeric linear algebra library for Scala, with rich Matlab-like operators on vectors and matrices; a library of numerical routines; support for plotting.
http://groups.google.com/group/scalala
GNU Lesser General Public License v2.1
298 stars 30 forks source link

Matrix Multiplication Performance Issue. #62

Closed avinashmaheshjoshi closed 12 years ago

avinashmaheshjoshi commented 12 years ago

Hey Folks, I was running some benchmakrs on different languages and started playing with scala. One of the test was to multiply matrices. This is taking a lot of time in scalala. I use the sbt -> console to start the interactive session and load scripts using :load command and the script has the following code

//Scala Code val start = System.currentTimeMillis() var T4 = DenseMatrix.randn(2800,2800) var T4_1 = T4.t * T4 val finish = System.currentTimeMillis() val timing = (finish - start) println(timing/1000)

The result of this code is 880 Secs. Which is surprisingly large when compared to other languages, R - 14.79 Secs Julia - 4.09 Secs Python - 34.49 Secs Am I doing something wrong here or is it because of the Dense Matrix ?

dlwh commented 12 years ago

I think the problem is that matrix transposes are slow in Scalala.

Scalala is dead, use breeze instead: https://github.com/scalanlp/breeze . It's going to be mostly api compatible with Scalala. I haven't implemented randn yet, but rand is there...

On my system (2.5 year old MBP), it's 32 seconds.

I don't know what Julia and R are doing to be so fast. I'm calling out to a java port of netlib, I guess I should look into it.