[julia-users] Re: Unexpected type behaviour in arithmetic operations

2014-02-28 Thread David P. Sanders
El viernes, 28 de febrero de 2014 07:49:09 UTC-6, andrew cooke escribió: the current behaviour is explained at http://julia.readthedocs.org/en/latest/manual/conversion-and-promotion/ But I don't find it evident from that document that Int32+Int32 gives Int64 on a 64-bit machine!

[julia-users] Interesting behaviour in IntSet

2014-02-28 Thread David P. Sanders
I am investigating possible data structures for an application. Here is an interesting behaviour in IntSet, which is no doubt to do with the implementation. Maybe it should just throw an exception if someone tries to add a really large integer like this! julia s = IntSet() IntSet() julia

[julia-users] Re: Interesting behaviour in IntSet

2014-02-28 Thread David P. Sanders
28. februar 2014 skrev David P. Sanders følgende: I am investigating possible data structures for an application. Here is an interesting behaviour in IntSet, which is no doubt to do with the implementation. Maybe it should just throw an exception if someone tries to add a really large

[julia-users] Re: Iteration over a Set where elements may be deleted in the process -- bug?

2014-02-28 Thread David P. Sanders
the loop, clean the first set using the elements of the second one. Ah, that's a neat solution, thanks! David. —Pierre-Yves On Thursday, February 27, 2014 4:54:58 PM UTC+1, David P. Sanders wrote: I need to iterate over a Set whose elements will be deleted in the process. However, some

[julia-users] Iteration over a Set where elements may be deleted in the process -- bug?

2014-02-27 Thread David P. Sanders
I need to iterate over a Set whose elements will be deleted in the process. However, some deleted elements are included in the iteration, e.g. the element 4 in the code below. Is this a bug, or am I misunderstanding? Thanks. julia s = Set(5, 3, 4, 6) Set{Int64}({5,4,6,3}) julia for i in s

[julia-users] Re: Iteration over a Set where elements may be deleted in the process -- bug?

2014-02-27 Thread David P. Sanders
El jueves, 27 de febrero de 2014 09:54:58 UTC-6, David P. Sanders escribió: I need to iterate over a Set whose elements will be deleted in the process. However, some deleted elements are included in the iteration, e.g. the element 4 in the code below. According to the following

Re: [julia-users] Re: Best data structure to remove elements one by one

2014-02-25 Thread David P. Sanders
El domingo, 23 de febrero de 2014 18:09:36 UTC-6, Jeff Bezanson escribió: This was just changed on master so that you'd do Set([i*2 for i in 1:5]). OK, that seems reasonable, thanks. On Sun, Feb 23, 2014 at 12:45 AM, David P. Sanders dpsa...@gmail.comjavascript: wrote: El

Re: [julia-users] List of indices of matrix satisfying certain criterion

2014-02-25 Thread David P. Sanders
El domingo, 23 de febrero de 2014 02:36:57 UTC-6, Mauro escribió: On Sun, 2014-02-23 at 05:51, dpsa...@gmail.com javascript: wrote: El viernes, 21 de febrero de 2014 08:25:00 UTC-6, Mauro escribió: Given a matrix, which will be large (say 10^5 x 10^5), I need to extract the

[julia-users] Re: Best data structure to remove elements one by one

2014-02-22 Thread David P. Sanders
El viernes, 21 de febrero de 2014 16:03:19 UTC-6, Steven G. Johnson escribió: On Friday, February 21, 2014 9:02:48 AM UTC-5, David P. Sanders wrote: OK, I think I have answered my own question: a Set is the good structure. And to create a set from an array I can do something like s

Re: [julia-users] Best data structure for a dynamic array

2014-02-22 Thread David P. Sanders
ecosystem! Thanks, David But without more information, these might all be wrong (or inefficient) for your problem. :-) Cheers, Kevin On Friday, February 21, 2014, David P. Sanders dpsa...@gmail.comjavascript: wrote: If I were to use instead a Set, instead of a Vector, how would

[julia-users] Re: Best data structure to remove elements one by one

2014-02-21 Thread David P. Sanders
El viernes, 21 de febrero de 2014 07:49:27 UTC-6, David P. Sanders escribió: Hi, Suppose I have a collection of elements that I will create once at the beginining, visit in an unknown order and delete one by one when they are visited. What is the most efficient data structure

[julia-users] Re: Best data structure for a dynamic array

2014-02-21 Thread David P. Sanders
El viernes, 21 de febrero de 2014 08:23:56 UTC-6, David P. Sanders escribió: Hi, I am having trouble finding the best equivalent of a list in Python, and the Pythonic idiom of creating an empty list and then adding elements one by one with .append(). For example, how would I do

[julia-users] Re: Best data structure for a dynamic array

2014-02-21 Thread David P. Sanders
21, 2014 2:23:56 PM UTC, David P. Sanders wrote: Hi, I am having trouble finding the best equivalent of a list in Python, and the Pythonic idiom of creating an empty list and then adding elements one by one with .append(). For example, how would I do this for a collection of ordered pairs

[julia-users] Re: Best data structure for a dynamic array

2014-02-21 Thread David P. Sanders
If I were to use instead a Set, instead of a Vector, how would this impact performance?

Re: [julia-users] Re: Re: Use an array as the index for selecting an element from another array

2014-02-18 Thread David P. Sanders
On Tue, Feb 18, 2014 at 8:15 PM, Eric Davies iam...@gmail.com wrote: FYI: julia function test_index() a = rand(100,100); pos = [1,1]; s = 0.0 for i = 1:1 s += a[pos[1], pos[2]] end end test_index (generic

[julia-users] Use an array as the index for selecting an element from another array

2014-02-17 Thread David P. Sanders
Hi, Suppose I have the following: r = rand(5, 5) I can select a single element of the array r using r[3, 4] Now suppose that I have the position [3, 4] stored in a variable as pos = [3, 4] How can I use pos as the index for selecting the *single* element r[3, 4]? I would like to do r[pos],

[julia-users] Re: Use an array as the index for selecting an element from another array

2014-02-17 Thread David P. Sanders
El lunes, 17 de febrero de 2014 18:57:10 UTC-6, David P. Sanders escribió: Hi, Suppose I have the following: r = rand(5, 5) I can select a single element of the array r using r[3, 4] Now suppose that I have the position [3, 4] stored in a variable as pos = [3, 4] How can I use

[julia-users] Re: Use an array as the index for selecting an element from another array

2014-02-17 Thread David P. Sanders
El lunes, 17 de febrero de 2014 19:03:55 UTC-6, Patrick O'Leary escribió: On Monday, February 17, 2014 6:57:10 PM UTC-6, David P. Sanders wrote: Hi, Suppose I have the following: r = rand(5, 5) I can select a single element of the array r using r[3, 4] Now suppose that I have

<    1   2   3