Logarithm of an array



A very basic question.

This used to work without fuss:


But with Julia 1.1 it is not valid any more:

MethodError: no method matching log(::Array{Float64,1})
Closest candidates are:
log(!Matched::Float16) at math.jl:1018
log(!Matched::Complex{Float16}) at math.jl:1019
log(!Matched::Float64) at special/log.jl:254

[1] top-level scope at In[21]:100:

My question is, It is necessary to use a loop to do it?


Use log.(A).

Also, please quote your code: PSA: how to quote code with backticks.


If you are upgrading old code, upgrade it to earlier Julia versions first so that you will see the deprecation messages. (log(array) was deprecated in Julia 0.6.)

(For example, if you have code that was written for Julia 0.5, first upgrade it to 0.6 and fix the deprecations, then upgrade it to 0.7 and fix the deprecations, then upgrade to 1.0 and 1.1. If you skip versions when upgrading, then you will get error messages instead of deprecation warnings … this is manageable, but requires more knowledge of how to fix things.)


Thank you all.


I also recommend this blog post for the rational between this change:


1 Like
split this topic #6

5 posts were split to a new topic: Performance of log.(x)