You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following function is type-unstable. However, if I just remove one of the parameters (positional or keyword), then the function becomes type stable. Is there a limit about the number of arguments ? 13 arguments are fine for type inference but not 14 or more.
functionmyfun(x,v::Vector{T},distbin,mincount;
len::T=1.,
var0::T=1.,
minlen::T=1e-5,
maxlen::T=10.,
minvar0::T=0.,
maxvar0::T=10.,
tolrel::T=1e-4,
maxpoints::Int=1000000,
nmean::Int=1,
stdcovar::T=1.
) where T
pmax =length(distbin)
distx =zeros(T,pmax)
for i =1:pmax
distx[i] = distbin[i]
endreturn distx
end
If I specify the type of distbin (for example UnitRange{Int64}), then type inference also works again.
It seems to me that there is some internal limit for the function specialization and type inference.
Is this documented some where?
I see this behaviour on julia 0.6.2 and 0.6.1.
Julia Version 0.6.2
Commit d386e40c17 (2017-12-13 18:08 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i3-3120M CPU @ 2.50GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.9.1 (ORCJIT, ivybridge)
The text was updated successfully, but these errors were encountered:
The following function is type-unstable. However, if I just remove one of the parameters (positional or keyword), then the function becomes type stable. Is there a limit about the number of arguments ? 13 arguments are fine for type inference but not 14 or more.
produces:
If I specify the type of
distbin
(for exampleUnitRange{Int64}
), then type inference also works again.It seems to me that there is some internal limit for the function specialization and type inference.
Is this documented some where?
I see this behaviour on julia 0.6.2 and 0.6.1.
The text was updated successfully, but these errors were encountered: