473,699 Members | 2,550 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 ...

Oct 22 '06 #1
0 1993

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

Similar topics

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)
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 }
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.
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 ?
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
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
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,
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
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...
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...
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,...
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...
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...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
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...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.