array manipulation without for loops

Sheldon shejo284 at gmail.com
Sun Jun 25 12:56:10 EDT 2006


Alex,

I am using Numeric and have created 3 arrays: zero((1215,1215),Float)
Two arrays are compared and one is used to hold the mean difference
between the two compared arrays. Then I compare 290 or 340 pairs of
arrays. I know that memory is a problem and that is why I don't open
all of these arrays at the same time. I cannot install Numpy due to my
working conditions. Sorry I should have made it clear that is was
Numeric I was working with.

/Sheldon

Alex Martelli wrote:

> Sheldon <shejo284 at gmail.com> wrote:
>
> > Hi Gary,
> >
> > I am really trying to cut the time down as I have 600+ arrays with
> > dimensions (1215,1215) to compare and I do a lot more things with the
> > arrays. If I understand you correctly, there is no way around a for
> > loop?
>
> In pure Python (w/o extension packages) there are no 2-D arrays; so
> either you're using lists of lists (and I wonder how you fit even one of
> them in memory, if they're 1215 by 1215, much less 600!) or you're
> already using some extension (Numeric, numarray, numpy) and aren't
> telling us which one.  If you're using pure Python add your extension of
> choice, if you're using an extension already tell us which one, and in
> each case there will be ways to perform your manipulation tasks faster
> than Python-level for loops would afford.
> 
> 
> Alex




More information about the Python-list mailing list