Ralf,
Could you please elaborate on the matrix weaknesses?
Is there any work planned to eliminate the peculiarities?
Regards,
Colin W.
Subject: Re: [Numpy-discussion] Relative speed
To: Discussion of Numerical Python <numpy-discussion@scipy.org>
Message-ID:
  Â
<CABL7CQjq6wZdfFmBgMhF5kFGpgQxqCY-Nv20=ZbMtLwPXDDa-w@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
On Thu, Aug 29, 2013 at 3:41 PM, Jonathan T. Niehof <jniehof@lanl.gov>wrote:
> > 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