[julia-users] Re: Julia Utopia: Share your tips and tricks to efficient coding in Julia

2016-05-14 Thread Cedric St-Jean
Jupyter has completely changed my workflow in Python and Julia. I've got my notebooks numbered 01_Planning_Invasion, 02_Moving_the_Troops, etc. I write most of my code inside the notebook interactively, then if it's good enough, it gets promoted to a .jl file. It takes about a week to complete

Re: [julia-users] Julia text editor on iPad?

2016-05-14 Thread Sheehan Olver
SageMathCloud doesn't seem to work that well on an iPad, unfortunately

Re: [julia-users] utils

2016-05-14 Thread Tom Breloff
For lots of small, possibly unrelated and possibly hard to classify functions, I'll typically put them in a file called utils.jl (utilities), misc.jl (miscellaneous) or common.jl (methods shared across modules). It's all roughly the same to me. On Saturday, May 14, 2016, Sisyphuss

[julia-users] Re: utils

2016-05-14 Thread Sisyphuss
But what does "Utilities" mean? I plan to put all my small functions frequently used by all other pieces of code into a single file. Is it the right file name for it? On Friday, May 13, 2016 at 7:11:45 PM UTC+2, Kristoffer Carlsson wrote: > > Utilities.

Re: [julia-users] Re: following down the chain of dispatch

2016-05-14 Thread Kevin Squire
The error you ran into is because of this PR: https://github.com/JuliaLang/julia/pull/16235 Gallium was updated for this, but those updates haven't made their way into a tagged release yet, so if you want to run on a Julia more recent than the above commit, as Tim pointed out, you'll need to get

Re: [julia-users] Re: following down the chain of dispatch

2016-05-14 Thread Tim Holy
Julia & Gallium are changing so rapidly, and work together so closely, that if you're wanting to use Gallium, you probably need to update both daily (or more frequently). Best, --Tim On Saturday, May 14, 2016 10:45:28 AM David van Leeuwen wrote: > Hello, > > On Saturday, May 14, 2016 at

Re: [julia-users] limiting println() precision using defaults or decorators

2016-05-14 Thread Salman Haider
Terrific. Thanks. On Friday, May 13, 2016 at 7:48:54 PM UTC-4, Tom Breloff wrote: > > Check out the Formatting package, as well as the spin-off > https://github.com/ScottPJones/StringUtils.jl > > On Friday, May 13, 2016, Salman Haider > wrote: > >> Hey guys, >> >> I have

Re: [julia-users] Re: following down the chain of dispatch

2016-05-14 Thread David van Leeuwen
Hello, On Saturday, May 14, 2016 at 10:57:18 AM UTC+2, Tim Holy wrote: > > On Saturday, May 14, 2016 01:05:39 AM David van Leeuwen wrote: > > Which version of Julia should I use? My 0.4.5 complains on install > "Gallium > > can't be installed because it has no versions that support 0.4.5 of

Re: [julia-users] Slow reading of file

2016-05-14 Thread Jacob Quinn
I'm actually one who is trying to increase overall things like integer parsing. Currently in the CSV.jl package, we have some beta-mode fast parsing functions. I generated a file with: open("test_integers","w") do f for i = 1:7_068_650 println(f, rand(Int16)) end end And reading

[julia-users] Re: Splatting speed

2016-05-14 Thread DNF
On version 0.5, after warm-up. (Notice that I use collect() instead of [], since the latter doesn't work like that anymore) function test_broad(N) @time for _ in 1:N broadcast( (x...) -> +(x...), collect(1:1000), collect(1001:2000) ) end @time for _ in 1:N broadcast( (x...) -> +(x...),

Re: [julia-users] Slow reading of file

2016-05-14 Thread Yichao Yu
On Sat, May 14, 2016 at 8:31 AM, Ford Ox wrote: > type Tokenizer > tokens::Array{ASCIIString, 1} > index::Int > Tokenizer(s::ASCIIString) = new(split(strip(s)), 0) > end > > Julia still runs 11 seconds... The main cost is not coming from the dynamic dispatch,but

Re: [julia-users] Slow reading of file

2016-05-14 Thread Eric Forgy
I don't see any "Please help me speed up my code"s or even any question marks at all. I just see complaints about Julia even after receiving initial suggestions from busy people (without any "Thank you"s). That may be one reason you're not receiving more helpful responses. Just a thought...

Re: [julia-users] Slow reading of file

2016-05-14 Thread Ford Ox
type Tokenizer tokens::Array{ASCIIString, 1} index::Int Tokenizer(s::ASCIIString) = new(split(strip(s)), 0) end Julia still runs 11 seconds... Dne sobota 14. května 2016 14:08:48 UTC+2 Milan Bouchet-Valat napsal(a): > > Le samedi 14 mai 2016 à 05:01 -0700, Ford Ox a écrit : > >

Re: [julia-users] Slow reading of file

2016-05-14 Thread Milan Bouchet-Valat
Le samedi 14 mai 2016 à 05:01 -0700, Ford Ox a écrit : > Fixed. Julia now takes 11 seconds to finish > type Tokenizer >     tokens::Array{AbstractString, 1} >     index::Int >     Tokenizer(s::AbstractString) = new(split(strip(s)), 0) > end > > type Buffer >     stream::IOStream >    

Re: [julia-users] Slow reading of file

2016-05-14 Thread Ford Ox
Fixed. Julia now takes 11 seconds to finish type Tokenizer tokens::Array{AbstractString, 1} index::Int Tokenizer(s::AbstractString) = new(split(strip(s)), 0) end type Buffer stream::IOStream tokenizer::Tokenizer Buffer(stream) = new(stream, Tokenizer("")) end Dne sobota

Re: [julia-users] Slow reading of file

2016-05-14 Thread Stefan Karpinski
There's lots of things that could be done in terms of clever optimizations, but currently this is how it is. If you want C speed, concretely type your fields. For flexibility, this can sometimes entail having type parameters. On Sat, May 14, 2016 at 1:52 PM, Ford Ox wrote:

Re: [julia-users] Slow reading of file

2016-05-14 Thread Ford Ox
Interesting. The compiler can't use the same hack it uses for multiple dispatch to generate multiple versions of types and then use only some of them? Dne sobota 14. května 2016 13:39:24 UTC+2 Stefan Karpinski napsal(a): > > Your types have totally untyped fields – the compiler has to emit very

[julia-users] Re: Slow reading of file

2016-05-14 Thread Ford Ox
I have fixed the Buffer constructor Buffer(stream) = new(stream, Tokenizer("")) Result is still the same. Dne sobota 14. května 2016 13:36:30 UTC+2 Ford Ox napsal(a): > > I have written exact same code in java and julia for reading integers from > file. > Julia code was A LOT slower. (12

Re: [julia-users] Slow reading of file

2016-05-14 Thread Stefan Karpinski
Your types have totally untyped fields – the compiler has to emit very pessimistic code about this. Rule of thumb: locations (fields, collections) should be as concretely typed as possible; parameters don't need to be. On Sat, May 14, 2016 at 1:36 PM, Ford Ox wrote: > I

[julia-users] Slow reading of file

2016-05-14 Thread Ford Ox
I have written exact same code in java and julia for reading integers from file. Julia code was A LOT slower. (12 seconds vs 1.16 seconds) import Base.isempty, Base.close ##Tokenizer ## type Tokenizer tokens index Tokenizer(s::AbstractString) = new(split(strip(s)), 0) end

Re: [julia-users] Re: NA vs NaN in DataFrames

2016-05-14 Thread Андрей Логунов
Thanks, Here's my first try restricted to Float64: function replaceNaN(df) nrows, ncols = size(df) for row in 1:nrows for col in 1:ncols v = df[row,col] if typeof(v) == Float64 && isnan(v) df[row,col] = NA end end end df end Am looking for an ideomatic and

Re: [julia-users] limiting println() precision using defaults or decorators

2016-05-14 Thread Scott Jones
On Friday, May 13, 2016 at 7:48:54 PM UTC-4, Tom Breloff wrote: > > Check out the Formatting package, as well as the spin-off > https://github.com/ScottPJones/StringUtils.jl Thanks for the tip of the hat, and right back at you! People should be aware, that some of the best parts of the

Re: [julia-users] Re: NA vs NaN in DataFrames

2016-05-14 Thread Tamas Papp
Also, in the meantime, you can use something like function nan2na(df) for c in eachcol(df) nans = find(x->isa(x,AbstractFloat) && isnan(x),c[2]) df[nans,c[1]] = NA end df end nan2na(mlmf) to convert NaNs to NAs. Best, Tamas On Sat, May 14 2016, Milan Bouchet-Valat

Re: [julia-users] Re: following down the chain of dispatch

2016-05-14 Thread Tim Holy
On Saturday, May 14, 2016 01:05:39 AM David van Leeuwen wrote: > Which version of Julia should I use? My 0.4.5 complains on install "Gallium > can't be installed because it has no versions that support 0.4.5 of julia", > in my 0.5.0 there is no package Gallium in Metadata. You probably need to

Re: [julia-users] Re: NA vs NaN in DataFrames

2016-05-14 Thread Milan Bouchet-Valat
Le samedi 14 mai 2016 à 17:49 +1000, Андрей Логунов a écrit : > using RDatasets, DataFrames > mlmf = dataset("mlmRev","Gcsemv"); > > Produces > > │ 1    │ "20920" │ "16"    │ "M"    │ 23.0    │ NaN    │ > │ 2    │ "20920" │ "25"    │ "F"    │ NaN     │ 71.2   │ > │ 3    │ "20920" │ "27"    │ "F"

[julia-users] Re: matlab vs julia slower fft

2016-05-14 Thread baillot maxime
Yes, I total forgot the fact that I need to use fftn in matlab my bad. After changing that and using an array of 2^12-1 I have the same time between Julia and Matlab. Also is it the right way to use plan_fft with the flag FFTW.PATIENT? pfft=plan_fft(Mb;flags=FFTW.PATIENT); and for one

Re: [julia-users] Re: following down the chain of dispatch

2016-05-14 Thread Stefan Karpinski
Unfortunately, backporting Gallium to 0.4.x is unlikely to be possible, so you have to be on a more recent Julia. It might still be worth stepping through the code on a 0.5 Julia for this purpose if the code works on both versions. On Sat, May 14, 2016 at 10:05 AM, David van Leeuwen <

[julia-users] Re: following down the chain of dispatch

2016-05-14 Thread David van Leeuwen
Thanks, On Wednesday, May 11, 2016 at 11:21:48 PM UTC+2, Kristoffer Carlsson wrote: > > If you get Gallium https://github.com/Keno/Gallium.jl working you can > simply step through the functions. Which version of Julia should I use? My 0.4.5 complains on install "Gallium can't be installed

[julia-users] Re: Julia Utopia: Share your tips and tricks to efficient coding in Julia

2016-05-14 Thread Liye zhang
(1) I use Debug.jl to debug the code, and it works. https://github.com/toivoh/Debug.jl (2) I use JuliaDT for code editor, which is similar to PyDev. The current version is 0.2. The future version would be a very good julia IDE. I currently use it for my daily work.

Re: [julia-users] Re: NA vs NaN in DataFrames

2016-05-14 Thread Андрей Логунов
using RDatasets, DataFrames mlmf = dataset("mlmRev","Gcsemv"); Produces │ 1│ "20920" │ "16"│ "M"│ 23.0│ NaN│ │ 2│ "20920" │ "25"│ "F"│ NaN │ 71.2 │ │ 3│ "20920" │ "27"│ "F"│ 39.0│ 76.8 │ │ 4│ "20920" │ "31"│ "F"│ 36.0│ 87.9

Re: [julia-users] Re: NA vs NaN in DataFrames

2016-05-14 Thread Tamas Papp
Again: please provide a self-contained example. On Sat, May 14 2016, Андрей Логунов wrote: > The misuse of the word is all mine. > But the problem persists. RDatasets in Win10 produce NaN-values for > unvailable values (NAs) as compared to Unices. > So the funcs dropna() and complete_cases()

Re: [julia-users] Re: NA vs NaN in DataFrames

2016-05-14 Thread Андрей Логунов
The misuse of the word is all mine. But the problem persists. RDatasets in Win10 produce NaN-values for unvailable values (NAs) as compared to Unices. So the funcs dropna() and complete_cases() 'do not work' as needed? no filtering done. As I understand Complete_cases() uses a bitarray. But is

[julia-users] Macros Hygiene

2016-05-14 Thread Ford Ox
Shouldn't macro use the same principle as functions? That is: If your macro changes the value of variable you passed as argument (say @increment x), thus it works similar to a function accepting pointer, it should be marked with "!" at the end? (@increment! x) If your macro changes variables

Re: [julia-users] Re: NA vs NaN in DataFrames

2016-05-14 Thread Tamas Papp
On Sat, May 14 2016, Андрей Логунов wrote: > To add, fiddling with array comprehensions as per the problem with NaNs > found a buggy thing. > The following code does not work: > > [x for x in filter(!isnan, convert(Array,dataframe[:fld]))] This is not a bug. ! does not operate on functions,