4 ms·
Interesting comparison! The criticism of julia is certainly valid, especially in terms of documentation. However, I wouldn't say that core language documentatio
by Sukera 4y ago
Interesting comparison! The criticism of julia is certainly valid, especially in terms of documentation. However, I wouldn't say that core language documentation should necessarily be geared towards any specific field.
In the implementation of the julia code there is a slight performance bug though (not sure if the authors submitted the article - the username certainly suggests it):
function likelihood(o, a, b, h, y2, N)
local lik = 0.0
for i in 2:N
@inbounds h = o+a*y2[i-1]+b*h
lik += log(h)+y2[i]/h
end
return(lik)
end
Only one use of y2 is marked @inbounds - in this case, either the second use too or the whole loop could be marked @inbounds (or the loop could be modified to run for all of eachindex(y2), with the first index being explicitly skipped).
- y_lin 4y agoThank you for your comment and looking at the code. This particular @inbound is not a bug. We tried the method you mentioned but it was slower. What surprised us was how little benefit we got from the @inbound
- Sukera 4y agoThat's surprising to me, as @inbounds should at worst be a noop - it shouldn't ever result in slower code. I sadly can't benchmark right now (no suitable device for the next few days), but I'll see if I can get back to this after that.
- freemint 4y agoYou might want to look into the zero function http://www.jlhub.com/julia/manual/en/function/zero http://www.jlhub.com/julia/manual/en/function/zero having a hard-coded 0.0 is a bit of a code smell and can sometimes cause the type instabilities i mentioned. For this code it should not make a difference as log retuns floats but ... it reads as not very Julian bc of that.