[julia-users] Re: Passing Array{Array{T,N},1} to a function

2015-09-29 Thread Tomas Lycken
If you’re trying this out in the REPL, you might have stumbled on the fact that list comprehensions currently aren’t type stable, unless you tell Julia the type of the elements. So instead of Xinput = [Array{Float64}(InnerArrayPts) for r in 1:OuterArrayPts] in your setup, do Xinput =

Re: [julia-users] Re: Passing Array{Array{T,N},1} to a function

2015-09-29 Thread Alan Crawford
Many thanks! alan On 29 Sep 2015, at 13:04, Tomas Lycken wrote: > makes a difference in this specific case is a little beyond me, but an > educated guess says that with that guarantee, it is possible to know what > type Array(Float64, InnerArrayPts) will return, making

[julia-users] Re: Passing Array{Array{T,N},1} to a function

2015-09-29 Thread Tomas Lycken
Type-inference in the REPL usually doesn’t give you as tight types as you’d like, mainly because it has to give room for what you *might* do in the future. Declaring variables const in the REPL (i.e. in global scope) helps with that, since it gives type-inference some guarantees that the

[julia-users] Re: Passing Array{Array{T,N},1} to a function

2015-09-29 Thread Alan Crawford
Thanks Tomas, works perfectly. I was testing out some code in the REPL... Relatedly and without abusing the thread too much, I wondered if you might be able to help me understand why the setting InnerArrayPts as const created the desired type stable array comprehension? Namely, const