Re: [Numpy-discussion] Relative speed

2013-08-30 Thread Stéfan van der Walt
On Fri, Aug 30, 2013 at 6:20 AM, Anubhab Baksi anubha...@gmail.com wrote:
 I need to deal with nearly 2**19 or 2**20 arrays of length about 250 each.

As mentioned elsewhere in this thread: what does deal mean.  You may
be better off with something like:

http://kwant-project.org/tinyarray/

Stéfan
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Relative speed

2013-08-29 Thread Anubhab Baksi
Hi,
I need to know about the relative speed (i.e., which one is faster) of the
followings:
1. list and numpy array, tuples and numpy array
2. list of tuples and numpy matrix (first one is rectangular)
3. random.randint() and numpy.random.random_integers()

Thank you.
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Relative speed

2013-08-29 Thread Jonathan T. Niehof
On 08/29/2013 09:33 AM, Anubhab Baksi wrote:
 Hi,
 I need to know about the relative speed (i.e., which one is faster) of
 the followings:
 1. list and numpy array, tuples and numpy array
 2. list of tuples and numpy matrix (first one is rectangular)
 3. random.randint() and numpy.random.random_integers()

African or European?

It really depends on what you're doing with it. The ipython %timeit 
magic is pretty useful for answering that question. Note that the answer 
may change dramatically based on the size of the data set.

-- 
Jonathan Niehof
ISR-3 Space Data Systems
Los Alamos National Laboratory
MS-D466
Los Alamos, NM 87545

Phone: 505-667-9595
email: jnie...@lanl.gov

Correspondence /
Technical data or Software Publicly Available
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Relative speed

2013-08-29 Thread Eric Moore

 African or European?


 Why on earth would you ask that?



Its a Monty Python and the Holy Grail reference.

Eric
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Relative speed

2013-08-29 Thread Ralf Gommers
On Thu, Aug 29, 2013 at 6:10 PM, Eric Moore e...@redtetrahedron.org wrote:


  African or European?
 
 
  Why on earth would you ask that?
 
 

 Its a Monty Python and the Holy Grail reference.


Thanks. I had read that quite differently, and I'm sure I'm not the only
one. Some context would have helped

Ralf
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Relative speed

2013-08-29 Thread Alan G Isaac
On 8/29/2013 3:48 PM, Ralf Gommers wrote:
 Some context would have helped.


http://www.youtube.com/watch?v=y2R3FvS4xr4

fwiw,
Alan

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Relative speed

2013-08-29 Thread Jonathan T. Niehof
On 08/29/2013 01:48 PM, Ralf Gommers wrote:

 Thanks. I had read that quite differently, and I'm sure I'm not the only
 one. Some context would have helped

My apologies--that was a rather obtuse reference.

In my oddly-wired brain it struck me as a fairly similar, 
suboptimally-posed question: all data structures sit in memory at the 
same speed, it's a question of the operations. And as you pointed out, 
most of the time for non-trivial datasets the numpy operations will be 
faster. (I'm daunted by the notion of trying to do linear algebra on 
lists of tuples, assuming that's the relevant set of operations given 
the comparison to the matrix class.)

-- 
Jonathan Niehof
ISR-3 Space Data Systems
Los Alamos National Laboratory
MS-D466
Los Alamos, NM 87545

Phone: 505-667-9595
email: jnie...@lanl.gov

Correspondence /
Technical data or Software Publicly Available
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Relative speed

2013-08-29 Thread Zachary Pincus
 And as you pointed out, 
 most of the time for non-trivial datasets the numpy operations will be 
 faster. (I'm daunted by the notion of trying to do linear algebra on 
 lists of tuples, assuming that's the relevant set of operations given 
 the comparison to the matrix class.)

Note the important and pretty common exception of building up a list one 
element (or row of elements) at a time. Here, python lists usually rule, unless 
the final size is known in advance.

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Relative speed

2013-08-29 Thread Benjamin Root
On Aug 29, 2013 4:11 PM, Jonathan T. Niehof jnie...@lanl.gov wrote:

 On 08/29/2013 01:48 PM, Ralf Gommers wrote:

  Thanks. I had read that quite differently, and I'm sure I'm not the only
  one. Some context would have helped

 My apologies--that was a rather obtuse reference.


Just for future reference, the language and the community is full of
references like these. IDLE, is named for Eric Idle, one of the members of
Monty Python, while Guido's title of BDFL is a reference to a sketch.

But I am sure you'd never expected that... :-p

Cheers!
Ben Root
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Relative speed

2013-08-29 Thread Anubhab Baksi
Thanks all, my client actually wants the output at a minimum time.

On Thu, Aug 29, 2013 at 11:30 PM, Ralf Gommers ralf.gomm...@gmail.comwrote:


 if you have a reasonably large amount of data (say O(100)),

 I need to deal with nearly 2**19 or 2**20 arrays of length about 250 each.


On Thu, Aug 29, 2013 at 11:30 PM, Ralf Gommers ralf.gomm...@gmail.comwrote:




 On Thu, Aug 29, 2013 at 3:41 PM, Jonathan T. Niehof jnie...@lanl.govwrote:

 On 08/29/2013 09:33 AM, Anubhab Baksi wrote:
  Hi,
  I need to know about the relative speed (i.e., which one is faster) of
  the followings:
  1. list and numpy array, tuples and numpy array
  2. list of tuples and numpy matrix (first one is rectangular)
  3. random.randint() and numpy.random.random_integers()


 Hi Anubhab, if you have a reasonably large amount of data (say O(100)),
 always try to use numpy arrays and not lists or tuples - it'll be faster.
 I'd recommend not to use numpy.matrix, it's speed will be similar to numpy
 arrays but it has some peculiarities that you'd rather not deal with. For
 the random numbers I'm not sure without checking, just timing it in ipython
 with %timeit is indeed the way to go.

 Cheers,
 Ralf


 African or European?


 Why on earth would you ask that?



 It really depends on what you're doing with it. The ipython %timeit
 magic is pretty useful for answering that question. Note that the answer
 may change dramatically based on the size of the data set.

 --
 Jonathan Niehof
 ISR-3 Space Data Systems
 Los Alamos National Laboratory
 MS-D466
 Los Alamos, NM 87545

 Phone: 505-667-9595
 email: jnie...@lanl.gov

 Correspondence /
 Technical data or Software Publicly Available
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion



 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion