Re: [julia-users] readandwrite: how can I read a line as soon as it's written by the process?

2015-06-28 Thread Jeff Waller
On Saturday, June 27, 2015 at 5:03:53 PM UTC-4, ele...@gmail.com wrote: Is your od program flushing its output? Maybe its stuck in its internal buffers, not in the pipe. nah man, if it's it's od, it's not going to do that, the only thing simpler is cat; I suppose you could try cat. What

Re: [julia-users] What's the best way to implement multiple methods with similar arguments?

2015-06-28 Thread ks
Hello Mauro, Thank you for your answer. 1. Use different function names: getitems, getitems_maxid. Not too elegant as you mix purpose and details of function usage in its name. 2. Use named arguments. This will cause the function implementation to grow (a series of if / else),

[julia-users] Re: What's the best way to implement multiple methods with similar arguments?

2015-06-28 Thread ks
Hello Andrew, Thanks! the other answer is on the money, but, in this particular case, it seems to me that you might want to have a function that could take both of those, with the idea that you never get more than max_num_items, but that if you find max_iter_id before that, the sequence

[julia-users] How to insert new row/ egsisitng vector into array ?

2015-06-28 Thread Ivar Nesje
No, array size for Array{T, N} where N 1 is immutable. I think I have read somewhere that this is to make it easier to have automatic bounds check hoisting in loop, but I don't think we have that yet.

[julia-users] Re: Sieve of Atkin performance.

2015-06-28 Thread Ismael VC
Stefan It's done, I've updated it with a MIT licence header: https://gist.github.com/Ismael-VC/179790a53c549609b3ce El domingo, 28 de junio de 2015, 10:16:16 (UTC-5), Ismael VC escribió: Hello everyone! I’ve implemented this Sieve of Atkin: -

[julia-users] Re: Sieve of Atkin performance.

2015-06-28 Thread Ismael VC
I used the wikipedia spanish version and algorithm, I didn't notice that it's a different one in the english version: * https://es.wikipedia.org/wiki/Criba_de_Atkin#Pseudoc.C3.B3digo I'll check that one too. El domingo, 28 de junio de 2015, 10:16:16 (UTC-5), Ismael VC escribió: Hello

Re: [julia-users] How to insert new row/ egsisitng vector into array ?

2015-06-28 Thread Stefan Karpinski
The main reason is actually that it's quite hard and, at best, very inefficient to do this in general. You have to move the elements of the entire array except in the very special case that you happen to be appending to the good dimension of an array. On Sun, Jun 28, 2015 at 4:13 AM, Ivar Nesje

Re: [julia-users] Re: Sieve of Atkin performance.

2015-06-28 Thread Stefan Karpinski
Are you willing to release this code under the MIT license http://julialang.org/license? On Sun, Jun 28, 2015 at 11:19 AM, Ismael VC ismael.vc1...@gmail.com wrote: Best out of 10 runs with a limit of 100,000,000. - Base.primes: 3.514 seconds (9042 k allocations: 194 MB, 0.22% gc time)

[julia-users] Sieve of Atkin performance.

2015-06-28 Thread Ismael VC
Hello everyone! I’ve implemented this Sieve of Atkin: - https://gist.github.com/Ismael-VC/179790a53c549609b3ce function atkin(limit::Int = 0) @inbounds begin primes = [2, 3] if limit 0 error(limit can't be negative (found $(limit))) elseif limit

[julia-users] Re: Sieve of Atkin performance.

2015-06-28 Thread Ismael VC
Yes certainly Stefan, I'll update the gist with a MIT licence note. El domingo, 28 de junio de 2015, 10:16:16 (UTC-5), Ismael VC escribió: Hello everyone! I’ve implemented this Sieve of Atkin: - https://gist.github.com/Ismael-VC/179790a53c549609b3ce function atkin(limit::Int = 0)

[julia-users] Re: Sieve of Atkin performance.

2015-06-28 Thread Ismael VC
Best out of 10 runs with a limit of 100,000,000. - Base.primes: 3.514 seconds (9042 k allocations: 194 MB, 0.22% gc time) - atkin: 2.036 seconds (20 allocations: 78768 KB, 0.03% gc time) - eratosthenes: 7.272 seconds (10 k allocations: 1677 MB, 1.58% gc time) El domingo,

[julia-users] Re: Sieve of Atkin performance.

2015-06-28 Thread Ismael VC
Is that header ok? What do you think about this? The wikipedia article claims that there is room for more improvement: This pseudocode is written for clarity; although some redundant computations have been eliminated by controlling the odd/even x/y combinations, it still wastes almost half

Re: [julia-users] readandwrite: how can I read a line as soon as it's written by the process?

2015-06-28 Thread Jameson Nash
yes, it is the fault of `od`. you can see this by using `cat` instead and observing that it works. if you play around with the thresholds in `od`, you will observe that it is doing block-buffering of 4096 byte chunks when the input is a pipe. Unless you turn on write buffering (with

Re: [julia-users] What's the best way to implement multiple methods with similar arguments?

2015-06-28 Thread Josh Langsfeld
The philosophy I try to follow is to use multiple dispatch when you don't care at the calling site what the types of your arguments are and therefore which method will be called. For example, consider the case when you receive some output from a library function and you either don't know or

[julia-users] Re: Current Performance w Trunk Compared to 0.3

2015-06-28 Thread Tony Kelman
Matt's been busy fixing all the things lately :) On Sunday, June 28, 2015 at 6:55:53 PM UTC-4, andrew cooke wrote: i am now back from my trip and have returned to this (i did try to look while away, but it seems that it was only on one of my machines - the one turned off and hidden from

[julia-users] Re: What's the best way to implement multiple methods with similar arguments?

2015-06-28 Thread andrew cooke
On Sunday, 28 June 2015 10:13:42 UTC-3, ks wrote: Hello Andrew, Thanks! the other answer is on the money, but, in this particular case, it seems to me that you might want to have a function that could take both of those, with the idea that you never get more than max_num_items, but that

[julia-users] Re: Current Performance w Trunk Compared to 0.3

2015-06-28 Thread andrew cooke
i am now back from my trip and have returned to this (i did try to look while away, but it seems that it was only on one of my machines - the one turned off and hidden from burglars in the closet - that was affected). anyway, pulling from git and rebuilding julia fixed the issue - it's now

[julia-users] Packed my function's parameters into a special immutable type. Expected slowdown, but my code is 20% faster. Why?

2015-06-28 Thread Andrew
In the interest of writing abstract code that I could modify easily depending on the economics model I need, I decided to pack the parameters of my utility function into a special type. Here's the old function. function u(UF::CRRA,a::Float64,aprime::Float64,y::Float64,r::Float64,w:: Float64)

[julia-users] Re: How to insert new row/ egsisitng vector into array ?

2015-06-28 Thread colintbowers
One way around this is to store data in Vector{Vector{T}} instead of Matrix{T}, then extend insert! to operate on each of the inner vectors. I have done this for a slightly more complicated type that includes a sorted list for indexing the inner vector and a header list for indexing the outer

Re: [julia-users] Packed my function's parameters into a special immutable type. Expected slowdown, but my code is 20% faster. Why?

2015-06-28 Thread Mauro
That it is as fast comes as no surprise as there is no overhead in Julia for this kind of data structure (immutable, isbits). Not sure why it is slightly faster though, it could be because of better memory alignment. On Sun, 2015-06-28 at 20:19, Andrew owen...@gmail.com wrote: In the interest

Re: [julia-users] PSA: new ~/.julia_history format

2015-06-28 Thread Khoa Tran
Dear Leo, I'm new to Julia. On MAC OSX, how do I actually delete the ~/.julia_history file? How do I find it? Best regards! Khoa On Sunday, June 8, 2014 at 12:28:36 AM UTC+2, K leo wrote: Lately, every time I start up julia I got the following error. And every time I have to delete