It does work. Thank you so much Glen.
Rizal On Mon, Nov 9, 2015 at 10:53 AM, Glen O <[email protected]> wrote: > Does the assertion form work any better? > > K=[dot(X[:,i],X[:,j])::Float64 for i=1:5, j=1:5] > > > > On Tuesday, 10 November 2015 02:51:35 UTC+10, rizal zaini wrote: >> >> When I put that code inside a function, I got the same behavior. >> >> For single process, K = Float64[dot(X[:,i], X[:,j]) for i=1:5, j=1:5] does >> the job. >> But for parallel I got error: "ERROR: malformed @parallel loop" >> >> Rizal >> >> On Mon, Nov 9, 2015 at 10:48 AM, Kristoffer Carlsson <[email protected]> >> wrote: >> >>> Don't run the code in global scope or alternatively be explicit about >>> the type you want, for example Float64[....] >>> >>> On Monday, November 9, 2015 at 5:42:15 PM UTC+1, rizal zaini wrote: >>>> >>>> My concern is also on parallel code: >>>> >>>> julia> K = @parallel [dot(X[:,i], X[:,j]) for i=1:5, j=1:5] 5x5 >>>> DArray{Any,2,Array{Any,2}}: 1.35134 1.36439 1.28474 1.13181 1.07863 1.36439 >>>> 1.40077 1.25708 1.22365 1.08332 1.28474 1.25708 1.54494 0.95311 1.15779 >>>> 1.13181 1.22365 0.95311 1.70348 1.30076 1.07863 1.08332 1.15779 1.30076 >>>> 1.34577 >>>> >>>> I expect to get a DArray{Float64,2,Array{Float64,2}} rather than >>>> DArray{Any,2,Array{Any,2}} >>>> >>>> Please help. >>>> >>>> Rizal >>>> >>>> On Mon, Nov 9, 2015 at 9:11 AM, rizal zaini <[email protected]> wrote: >>>> >>>>> Hi all >>>>> >>>>> I want to create matrix containing dot products >>>>> >>>>> julia> X = rand(5,5) >>>>> 5x5 Array{Float64,2}: >>>>> 0.274799 0.564619 0.915595 0.341059 0.57361 >>>>> 0.0806822 0.293939 0.379279 0.608582 0.652441 >>>>> 0.264678 0.532751 0.289088 0.457759 0.492777 >>>>> 0.33856 0.495587 0.499099 0.548237 0.402534 >>>>> 0.686305 0.168385 0.8322 0.605532 0.518693 >>>>> >>>>> julia> K = [dot(X[:,i], X[:,j]) for i=1:5, j=1:5] >>>>> 5x5 Array{Any,2}: >>>>> 0.737716 0.603229 1.09884 0.865174 0.832958 >>>>> 0.603229 0.962978 1.16994 0.988988 1.06501 >>>>> 1.09884 1.16994 2.00739 1.45298 1.54767 >>>>> 0.865174 0.988988 1.45298 1.36347 1.35304 >>>>> 0.832958 1.06501 1.54767 1.35304 1.42861 >>>>> >>>>> I expect to get an Array{Float64,2}, but what I got is Array{Any,2}. >>>>> How to get Array{Float64,2} using Array comprehension? >>>>> >>>>> Thanks before >>>>> Rizal >>>>> >>>> >>>> >>
