Thanks for the fast reply ¡¡ :)
try something like this?
function k_vector(s :: Array{Float64,1}, z :: Array{Float64,1})
n = length(s)
k = Int64[sum(s .< z[i]) for i = 2:n-1]
return k
end
yes is better, but not so much. Maybe with another more smart method for
calculate k
2014-04-17 11:22 GMT-03:00 Stefan Karpinski <[email protected]>:
> First off, try putting it inside of a function instead of in global scope:
>
>
> http://julia.readthedocs.org/en/latest/manual/performance-tips/#avoid-global-variables
>
>
> On Thu, Apr 17, 2014 at 10:15 AM, El suisse <[email protected]> wrote:
>
>> Hi, I want improve the performance of the for loop, any suggestion?
>>
>> https://gist.github.com/elsuizo/10986149
>>
>> I try:
>>
>> k3 = Int64[ sum(s .< z[i]) for i = 2:n-1]
>>
>> but is still slower than Matlab
>>
>>
>> Thanks in advance
>>
>
>