Re: [julia-users] Comprehension Produces Any

2014-09-12 Thread Christoph Ortner
That is useful to know - thanks.

Re: [julia-users] Comprehension Produces Any

2014-09-12 Thread Stefan Karpinski
You can declare them outside the loop with the local keyword – that a better option and less likely to lead to type inference issues. > On Sep 12, 2014, at 11:59 PM, Christoph Ortner > wrote: > > > The point was to be able to access d1, d2 outside the loop to check their > types. >

Re: [julia-users] Comprehension Produces Any

2014-09-12 Thread Christoph Ortner
The point was to be able to access d1, d2 outside the loop to check their types.

Re: [julia-users] Comprehension Produces Any

2014-09-12 Thread Kevin Squire
On Friday, September 12, 2014, Douglas Bates wrote: > On Friday, September 12, 2014 12:41:49 AM UTC-5, Christoph Ortner wrote: >> >> That did work - thank you, see code below. To explain: this came from a >> bottleneck in a bigger code, so my problem there must be a different one. >> -- Christ

Re: [julia-users] Comprehension Produces Any

2014-09-12 Thread Douglas Bates
On Friday, September 12, 2014 12:41:49 AM UTC-5, Christoph Ortner wrote: > > That did work - thank you, see code below. To explain: this came from a > bottleneck in a bigger code, so my problem there must be a different one. > -- Christoph > > function testtime() > a1 = rand(10, 10, 100, 10

Re: [julia-users] Comprehension Produces Any

2014-09-12 Thread gael . mcdon
> > @time(begin > for n = 1:10 > d1 = Float64[ a1[a,b,i,j] .* b1[a,i,j] .* c1[b,i,j] for a = 1:10, > b = 1:10, i=1:100,j=1:100 ] > end > end) > For the sake of completeness, begin ... end blocks are not local. I thought let blocks would but it appears they don't.

Re: [julia-users] Comprehension Produces Any

2014-09-11 Thread Christoph Ortner
And here the OUTPUT: elapsed time: 0.110285914 seconds (80001120 bytes allocated, 59.36% gc time) Array{Float64,4} elapsed time: 0.079318859 seconds (80001120 bytes allocated, 43.25% gc time) Array{Float64,4}

Re: [julia-users] Comprehension Produces Any

2014-09-11 Thread Christoph Ortner
That did work - thank you, see code below. To explain: this came from a bottleneck in a bigger code, so my problem there must be a different one. -- Christoph function testtime() a1 = rand(10, 10, 100, 100) b1 = rand(10, 100, 100) c1 = rand(10, 100, 100) d1 = [] const a2 =

Re: [julia-users] Comprehension Produces Any

2014-09-11 Thread Jameson Nash
You are still trying to run in global scope. Put your code in a function before drawing conclusions. On Fri, Sep 12, 2014 at 12:58 AM, Christoph Ortner < christophortn...@gmail.com> wrote: > On Friday, 12 September 2014 02:24:15 UTC+1, gael@gmail.com wrote: > >> Wouldn't it be enough to put

Re: [julia-users] Comprehension Produces Any

2014-09-11 Thread Christoph Ortner
On Friday, 12 September 2014 02:24:15 UTC+1, gael@gmail.com wrote: > Wouldn't it be enough to put it in a local scope (let block or in a > function?). > > For more information, you can ask or look at the Performance tips part of > the manual. > I'd be interested in. Here is another code bloc

Re: [julia-users] Comprehension Produces Any

2014-09-11 Thread gael . mcdon
Wouldn't it be enough to put it in a local scope (let block or in a function?). For more information, you can ask or look at the Performance tips part of the manual.

Re: [julia-users] Comprehension Produces Any

2014-09-11 Thread Jiahao Chen
You may be interested in issue #7258 and the julia-dev thread linked to in there. Thanks, Jiahao Chen Staff Research Scientist MIT Computer Science and Artificial Intelligence Laborator

[julia-users] Comprehension Produces Any

2014-09-11 Thread Christoph Ortner
Here is a short code snippet, that got me puzzled. [Julia Version 0.3.0, Commit 7681878* (2014-08-20 20:43 UTC), Darwin (x86_64-apple-darwin13.3.0)] a = rand(3,3) b = rand(3,3) println(typeof( [a[i,j]*b[i,j] for i = 1:3, j=1:3])) println(typeof(a .* b)) Array{Any,2} Array{Float64