Languages

You are currently browsing the archive for the Languages category.

Julia!

I am quite excited about the Julia language (windows download, manual). It’s free. It’s almost the same as Matlab, but it is as fast as C++ (much faster than Matlab and Octave, 160 times faster in the example below). Here is a quick comparison.

Matlab code (primeQ.m):

function b = primeQ( i )
   for j=2:ceil(i/2.0)
       if mod(i,j) == 0
           b = false;
           return
       end
   end
   b = true;
end

Matlab input:

tic; primeQ(71378569); toc

Matlab output:

Elapsed time is 52.608765 seconds.

Julia code (primeQ.jl):

function primeQ( i )
   for j=2:ceil(i/2.0)
       if mod(i,j) == 0
           return false;
       end
   end
   return true 
end

Julia input:

load(“primeQ.jl”)

tic(); primeQ(71378569); toc()

Julia output:

elapsed time: 0.3280000686645508 seconds

Walkingrandomly.com has a post on the Julia computer language which seems to be getting faster. Carl and I have stumbled across many languages in our efforts to get a fast version of lisp with good debugging tools. For a while we thought at one time that Haskell was the answer, but it now seems we are leaning more toward Clojure and Python recently. It is hard to pass up languages that can use tools like WEKA, SciPy, and Numpy. Another option is R, but only one of my friends uses R. Clojure is neat because it runs on the JVM and Javascript (and is being targeted at other languages such as Python, Scheme, and C).

For a speed comparison with Matlab, see this post.

A huge numbers of videos from PyCon 2012 Us are available at pyvideo.org. Marcel Caraciolo at aimotion.blogspot.com posted links to 17 of them on his blog. I have been avoiding Python for machine learning, but maybe I’ve been wrong.

Newer entries »