Hi all, I am very new to Julia, and I am trying it with a dive-in approach, translating of a python script of mine. The results are already encouraging, since I get almost the same performance as the highly optimized numpy code with trivial Julia code (finally I can write for cycles!), but I think (because I profiled) I would gain a lot from optimizing the following linearly interpolating function:
function interp1d(x::Array{Float64,1},x0::Array{Float64,1},y0::Array{Float64 ,1}) y = zeros(x)*NaN; jj = 1 for ii in 1:length(y) if x0[1]<x[ii]<x0[end] jj = findnext(val->val>x[ii],x0,jj)-1; y[ii] = y0[jj] + (y0[jj+1]-y0[jj])/(x0[jj+1]-x0[jj])*(x[ii]-x0[ jj]); end end return y; end I guess that findnext may not be the best choice, and possibly metaprogramming could help, but I am mostly new to it and I would appreciate some sort of introduction. Could someone point me to resources to make progress, or do you have any suggestion? Thanks, Andrea