Aren’t the programs in Kristofer’s repo in good shape? I believe some or all of them should be submitted. I guess I could (but should I)? I don’t want to take anyone’s credit.
I decided to look into one of the programs that didn’t have a Julia implementation (I see however now it’s in Kristofer’s repo), and to translate this fastest [C++] non-multi-threaded version:
It uses Eigen library, and since that’s allowed, I guess we could use similar [Julia] libraries, or even the Julia Eigen wrapper.
However, I just started with translating the commented out “EQUIVALENT MATLAB IMPLEMENTATION”. It’s trivial to do, but I opted to try the http://sciencecow.mit.edu/matlab-to-julia/ translator anyway. I ended up with this (maybe it just isn’t “EQUIVALENT”, anyone know what’s wrong?) that’s fast on my very old laptop but wrong:
julia> function approximate(n)
A = zeros(n,n)
A[i,j] = 1.0/((i+j)*(i+j+1)/2.0 + i+1.0)
u = ones(n,1)
v = zeros(n,1)
v = A'*(A*u)
u = A'*(A*v)
approximate (generic function with 1 method)
julia> @time approximate(5500)
5.461645 seconds (9.13 k allocations: 232.940 MB, 0.72% gc time)
The translator got this line wrong (anyone know why? and I should file a bug):
and I changed integers to floats here: A[i,j] = 1.0/((i+j)*(i+j+1)/2.0 + i+1.0)
I got the same result as expected and seems same speed (was just checking).
I opened um my MATLAB clone, Octave to just make sure, and I get the same number eventually. Probably after minutes, ten[s?]. At least Julia is way faster, can anyone compare real MATLAB to Julia for me?