Hi all,

I'm on Julia v0.3.10 on Ubuntu 14.04 LTS. The following loop comprehension 
correctly infers the type:

function g()
    x = randn(3, 2)
    inds = rand(1:3, 3, 4)
    y = [ mean(sub(x, 1:size(x, 1), k)[sub(inds, 1:size(inds, 1), j)]) for 
k = 1:size(x, 2), j = 1:size(inds, 2) ]
    println(typeof(y))
end

That is, the println statement returns Array{Float64, 2}.

Inside another one of the my functions, I have the following code snippet

function someFunction(lD::Matrix{Float64}, ...)

    ...

    println(typeof(lD))
    println(typeof(inds))

    mldBoot1 = [ mean(sub(lD, 1:size(lD, 1), k)[sub(inds, 1:size(inds, 1), 
j)]) for k = 1:size(lD, 2), j = 1:size(inds, 2) ]

    println(typeof(mldBoot1))

    ....

end

The three println statements return, in order:

    Array{Float64,2}
    Array{Int64,2}
    Array{Any,2}

I've been messing around for a couple of hours now trying to work out why 
it works in my toy example, but not in my more complicated function and 
I've come up with nothing. Anyone else have any ideas?

Cheers,

Colin

Reply via email to