473,325 Members | 2,342 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Speed comparison of Numeric, numarray, numpy

just a note - some speed comparisons :
>>timeit.Timer('x=a-a*.1','import Numeric;a=Numeric.ones(300,Numeric.Float)').timeit (10000)
0.60627370238398726
>>timeit.Timer('x=a-a*.1','import numarray;a=numarray.ones(300,numarray.Float)').tim eit(10000)
0.42836673376223189
>>timeit.Timer('x=a-a*.1','import numpy;a=numpy.ones(300,numpy.float)').timeit(10000 )
0.36965815487747022
>>timeit.Timer('x=a[30:40]','import Numeric;a=Numeric.ones(300,Numeric.Float)').timeit (10000)
0.016557970357098384
>>timeit.Timer('x=a[30:40]','import numarray;a=numarray.ones(300,numarray.Float)').tim eit(10000)
0.15692469294117473
>>timeit.Timer('x=a[30:40]','import numpy;a=numpy.ones(300,numpy.float)').timeit(10000 )
0.01951756438393204
>>timeit.Timer('x=MLab.max(a)','import Numeric,MLab;a=Numeric.ones(300,Numeric.Float)').t imeit(10000)
0.21454933518180042
>>timeit.Timer('x=a.max()','import numarray;a=numarray.ones(300,numarray.Float)').tim eit(10000)
0.70624786110965942
>>timeit.Timer('x=a.max()','import numpy;a=numpy.ones(300,numpy.float)').timeit(10000 )
0.21168165227754798
>>timeit.Timer('x=MLab.max(a[30:40])','import Numeric,MLab;a=Numeric.ones(300,Numeric.Float)').t imeit(10000)
0.21775784352394112
>>timeit.Timer('x=a[30:40].max()','import numarray;a=numarray.ones(300,numarray.Float)').tim eit(10000)
0.81516337970242603
>>timeit.Timer('x=a[30:40].max()','import numpy;a=numpy.ones(300,numpy.float)').timeit(10000 )
0.21344193186450866
>>timeit.Timer('a*=0.99','import Numeric;a=Numeric.ones(300,Numeric.Float)').timeit (10000)
0.293094513410324
>>timeit.Timer('a*=0.99','import numarray;a=numarray.ones(300,numarray.Float)').tim eit(10000)
0.061937480881169904
>>timeit.Timer('a*=0.99','import numpy;a=numpy.ones(300,numpy.float)').timeit(10000 )
0.16990958347923879
strange differences in all directions ...

robert
Oct 22 '06 #1
0 1972

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: myang | last post by:
Hi, I have thousands of points in 3D space, and I want to calcuate the distance between each other of them. I do the calculation with the following code. def distance(a,b): sum = 0 for i in...
11
by: grv | last post by:
So it is supposed to be very fast to have an array of say 5 million integers stored in a binary file and do a = numarray.fromfile('filename', (2, 2, 2)) numarray.add(a, 9, a) but how is that...
0
by: Cedric | last post by:
This is a 3 weeks old problem, but having found a solution (and having looked for one here, finding only this message), I'm replying now. From: Jive (someone@microsoft.com) Subject: Upgrade...
22
by: J | last post by:
Hi I hope the title of this message indicates my question. I am looking for basic array functionality in Python and it turns out that there are all these packages which are somehow related....
10
by: Bryan | last post by:
hi, what is the difference among numeric, numpy and numarray? i'm going to start using matplotlib soon and i'm not sure which one i should use. this page says, "Numarray is a...
12
by: mart.franklin | last post by:
I hope I am not being too ignorant :p but here goes... my boss has written a bit of python code and asked me to speed it up for him... I've reduced the run time from around 20 minutes to 13 (not...
5
by: auditory | last post by:
I am a newbie here I am trying to read "space separated floating point data" from file I read about csv module by searching this group, but I couldn't read space separated values with csv....
4
by: Christian Convey | last post by:
I need to bang out an image processing library (it's schoolwork, so I can't just use an existing one). But I see three libraries competing for my love: numpy, numarray, and numeric. Can anyone...
5
by: Erik Johnson | last post by:
I am just starting to explore doing some scientific type data analysis using Python, and am a little confused by the different incarnations of modules (e.g., try Google("Python numeric"). There...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.