I recently poked around a bit with the @code_warntype macro in my code and
quickly realized that a lot of my variables were assigned "Any" at compile
time. I tried to find the reason for it and got down to the eig function:
julia> @code_warntype eig(rand(Float64, 5,5))
Variables:
A::Array{Float64,2}
args::Tuple{}
Body:
begin $(Expr(:line, 66, symbol("linalg/eigen.jl"), symbol("")))
GenSym(8) = (top(ccall))(:jl_alloc_array_1d,$(Expr(:call1,
:(top(apply_type)), :Array, Any, 1)),$(Expr(:call1, :(top(svec)), :Any,
:Int)),Array{Any,1},0,0,0)::Array{Any,1}
GenSym(9) = GenSym(8)
return __eig#179__(GenSym(9),A::Array{Float64,2})::Tuple{Any,Any}
end::Tuple{Any,Any}
Is there a reason this returns Tuple{Any, Any} instead of Tuple{Complex128,
Complex128} as you might expect? As far as I understand it this causes
everything touched by the eig function to become type unstable.