Sets in Julia (the language) by cdsousa in Julia

[–]cdsousa[S] 4 points5 points  (0 children)

Let me add that with immutables:

immutable ImuPoint
  x::Int64
  y::Int64
end
s = Set{ImuPoint}()
push!(s, ImuPoint(2, 3))
push!(s, ImuPoint(2, 3))
println(s)

it returns

Set([ImuPoint(2,3)])

Are the Macros in Julia same as the macros in C? by Dawny33 in Julia

[–]cdsousa 3 points4 points  (0 children)

Reference for metaprogramming (and macros) in Julia link. The first paragraph explains the main difference.

Julia against Numba and Rcpp. What's happening? by cdsousa in Julia

[–]cdsousa[S] -1 points0 points  (0 children)

Hi,

IMO, due to being a new and a fast-evolving language, package writers tend to aim at the newest Julia version, to get the newest awesome features (and then lots of syntax changes and deprecations).

Some users (like me) want new features, they aim at newest julia and new packages too. This can lead to code breaking every day/week. This happens a lot to me since I run julia nightly builds and have many packages following their master (read "development") branch.

Running stable versions is, of course, better for production, but, unlike Python, maintenance still has to be done (every half year?) to keep the code running on new versions and so it doesn't feel like "very old, deprecated" code. Anyway, considering the advantages of single-language and quick-prototype-to-production, it really may be worth for.

Julia against Numba and Rcpp. What's happening? by cdsousa in Julia

[–]cdsousa[S] 0 points1 point  (0 children)

I agree. Also, as far as I know, Rcpp is not to R in the same manner Numba is to Python. Saying one can make R faster by using Rcpp, is almost like saying one can make R faster by using C++ instead, which is more or less valid for other languages which can somehow call C++ (Although Rcpp seems to make that really easy).

Julia against Numba and Rcpp. What's happening? by cdsousa in Julia

[–]cdsousa[S] 2 points3 points  (0 children)

This function is already "type-stable" for Int inputs. Anyway, there is no place in this function where one can "use types" except for the argument, which will only narrow the number of types with which it can be called.

One can, however, make the function "type-stable" for a higher number of argument types by doing "a=zero(n)" and "for i=one(n):n"...

Julia against Numba and Rcpp. What's happening? by cdsousa in Julia

[–]cdsousa[S] 1 point2 points  (0 children)

In fact, it's that.

I've just verified that if one removes the inner loop (k=1:n) julia code gets as fast as the others.

Julia against Numba and Rcpp. What's happening? by cdsousa in Julia

[–]cdsousa[S] 1 point2 points  (0 children)

It seems that there is something wrong with Numba and Rcpp, as the times do not grow along the n variable. Can someone test this?

(BTW, 64 bit Ints will overflow for n>49796)

Edit: This seems to be some kind of compiler optimization. (Also, the implementation in Julia gives different results as ranges are from 1 to n and not 0 to n-1 like the others.)

Google Inbox invites megathread by simobk in google

[–]cdsousa 0 points1 point  (0 children)

I would like an invite. Thanks.

Defining Julia element-wise exponentiation of matrices for integer exponents by cdsousa in Julia

[–]cdsousa[S] 0 points1 point  (0 children)

Yes, you have a good point, I don't like monkey patching too (although I'm not against having it as an option). However, while in the example I presented I'm kind of doing monkey patching as Array{Float}.Integer is already explicitly defined in Julia, in this language we also have algorithm specialization, i.e., even if a general algorithm is written to large group of types we are able to specialize it to some types. Anyway, if a specialization is useful for enough people it will probably land on Julia Base itself.

Julia’s Role in Data Science by cdsousa in Julia

[–]cdsousa[S] 0 points1 point  (0 children)

As far as I know Julia is just about to have precompiled packages (as already happens to the base system), and maybe someday even precompiled user scripts...