Julia is not as performant with anonymous functions, and list 
comprehension.   
The compiler has a harder time with the optimization step.  This is not a 
surprise and is
known to the language designers.  This is not a surprise.


On Saturday, July 5, 2014 8:01:46 PM UTC-5, [email protected] wrote:
>
>
> In Apprentice.6,  I don't think you want to use the sqrtm().  sqrt() is 
> already vectorized over the matrix.  Also a couple of '.'s are misplaced, 
> so perhaps instead:
>
> Z =rand(10,2)
>
> D = sqrt((Z[:,1].-Z[:,1]').^2+(Z[:,2].-Z[:,2]').^2)
>
> As a newbie myself, what surprised me is that this is faster and allocates 
> less memory than the comprehension:
>
> D =  [norm(Z[i,:]-Z[j,:],2) for i = 1:10, j = 1:10]
>
> I am sure someone else here can explain why.
>
> Jim
> On Sunday, June 22, 2014 10:43:32 AM UTC-4, Michiaki Ariga wrote:
>>
>> Hi all,
>>
>> I'm a Julia newbee, and I'm trying to learn Julia and wrote Julia version 
>> of rougier's 100 numpy exercises(
>> http://www.loria.fr/~rougier/teaching/numpy.100/index.html).
>>
>> https://github.com/chezou/julia-100-exercises
>>
>> I'd like you to tell me more "julia way" or something wrong with.
>>
>> Best regards,
>> Michiaki
>>
>

Reply via email to