473,723 Members | 2,218 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Speed comparison of Numeric, numarray, numpy

just a note - some speed comparisons :
>>timeit.Timer( 'x=a-a*.1','import Numeric;a=Numer ic.ones(300,Num eric.Float)').t imeit(10000)
0.6062737023839 8726
>>timeit.Timer( 'x=a-a*.1','import numarray;a=numa rray.ones(300,n umarray.Float)' ).timeit(10000)
0.4283667337622 3189
>>timeit.Timer( 'x=a-a*.1','import numpy;a=numpy.o nes(300,numpy.f loat)').timeit( 10000)
0.3696581548774 7022
>>timeit.Timer( 'x=a[30:40]','import Numeric;a=Numer ic.ones(300,Num eric.Float)').t imeit(10000)
0.0165579703570 98384
>>timeit.Timer( 'x=a[30:40]','import numarray;a=numa rray.ones(300,n umarray.Float)' ).timeit(10000)
0.1569246929411 7473
>>timeit.Timer( 'x=a[30:40]','import numpy;a=numpy.o nes(300,numpy.f loat)').timeit( 10000)
0.0195175643839 3204
>>timeit.Timer( 'x=MLab.max(a)' ,'import Numeric,MLab;a= Numeric.ones(30 0,Numeric.Float )').timeit(1000 0)
0.2145493351818 0042
>>timeit.Timer( 'x=a.max()','im port numarray;a=numa rray.ones(300,n umarray.Float)' ).timeit(10000)
0.7062478611096 5942
>>timeit.Timer( 'x=a.max()','im port numpy;a=numpy.o nes(300,numpy.f loat)').timeit( 10000)
0.2116816522775 4798
>>timeit.Timer( 'x=MLab.max(a[30:40])','import Numeric,MLab;a= Numeric.ones(30 0,Numeric.Float )').timeit(1000 0)
0.2177578435239 4112
>>timeit.Timer( 'x=a[30:40].max()','import numarray;a=numa rray.ones(300,n umarray.Float)' ).timeit(10000)
0.8151633797024 2603
>>timeit.Timer( 'x=a[30:40].max()','import numpy;a=numpy.o nes(300,numpy.f loat)').timeit( 10000)
0.2134419318645 0866
>>timeit.Timer( 'a*=0.99','impo rt Numeric;a=Numer ic.ones(300,Num eric.Float)').t imeit(10000)
0.2930945134103 24
>>timeit.Timer( 'a*=0.99','impo rt numarray;a=numa rray.ones(300,n umarray.Float)' ).timeit(10000)
0.0619374808811 69904
>>timeit.Timer( 'a*=0.99','impo rt numpy;a=numpy.o nes(300,numpy.f loat)').timeit( 10000)
0.1699095834792 3879
strange differences in all directions ...

robert
Oct 22 '06 #1
0 1994

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

Similar topics

5
1633
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 range(len(a)): sum += (a-b)**2 return sqrt(sum)
11
1988
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 faster than reading the entire file into memory and then having a for loop in C: (loop over range) { *p++ += 9 }
0
1526
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 woes: Numeric, gnuplot, and Python 2.4 Date: 2004-12-11 18:45:10 PST > Here's my sitch: > > I use gnuplot.py at work, platform Win32. > I want to upgrade to Python 2.4.
22
2004
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. Some are allegedly discontinued but still seem to get updated. Could we start a discussion about which package will or may or should survive ?
10
2241
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 re-implementation of an older Python array module called Numeric" http://www.stsci.edu/resources/software_hardware/numarray
12
8350
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 bad I think ;) to speed it up further I asked him to replace a loop like this:- index = 0 for element in a: av = a
5
4125
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. (which may be matter of course..) I also read about numpy.fromfile(file, sep=' ') which i can use. but on my machine(ubuntu linux) numpy is unknown module,
4
3377
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 recommend which one I should use? If one is considered the officially blessed one going forward, that would be my ideal. Thanks, Christian
5
1284
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 is SciPy, NumPy, NumArray, Numeric... I know some of these are related and some are separate, some are oudated, etc. but can someone sort of give a general run-down in layman's terms of what's what, what's used for what, what depends on what, and...
0
8868
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8741
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9388
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9241
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8062
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4504
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4764
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2612
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2149
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.