Tuesday, February 7, 2017

Julia syntax in vim

I try to put julia syntax in Macvim. I found this github repository: https://github.com/JuliaEditorSupport/julia-vim and I blindly follow the instructions in https://github.com/JuliaEditorSupport/julia-vim#manually , starting from ~/.vim . It does work:


There are some cool tricks, for instance I can write Unicode :
\alpha + Tab = α

Friday, February 3, 2017

tests with Julia

So, after having installed Julia months ago I gave it some tries. The speedup seems larger than an order of magnitude in both cases

looping through the same matrix

R
system.time({val=0; for (i in 1:2000){for (j in 1:2000){val=val+a[i,j]}}; val})
   user  system elapsed 
  1.862   0.015   1.868 
Julia
julia> tic(); val=0; for i in 1:2000; for j in 1:2000; val=val+a[i,j]; end; end; println(val); toc()
5.142821063269366
elapsed time: 0.327145074 seconds
0.327145074

Singular value decomposition of a 2000 x 2000 matrix


> a=matrix(rnorm(4000000),2000)
> system.time(svd(a))
   user  system elapsed 
 27.419   0.218  27.452 
Julia
julia> tic(); a=randn(2000,2000); toc()
elapsed time: 0.673701438 seconds
0.673701438

julia> tic(); svd(a); toc()
elapsed time: 5.236212822 seconds
5.236212822