[Numpy-discussion] 2D Arrays column operations

Lou Pecora lou_boog2000 at yahoo.com
Thu Mar 29 16:32:17 EDT 2007


Others can correct me, but I believe the ndarrys of
numpy are *not* stored like C arrays, but rather as a
contiguous memory chunk (there are some exceptions,
but ignore for the moment).  Then along with the data
is a structure that tells numpy how to "address" the
array's data memory using indices (+ other array
info).  In particular, the structure tells numpy the
dimension and the strides for each dimension so it can
skip along and pick out the right components when you
write   c=a[:,1].

I'm sure Travis will correct me if I'm off, but I
think this is basically how numpy arrays operate.


--- Simon Berube <sberub at gmail.com> wrote:

> Awww, this is quite right. I kept using the a[0][:]
> notation and I
> assume I am simply pulling out single arrays from
> the array "list".
> 
> Thank you very much for the prompt reply. (And sorry
> for wasting your
> time :P)


-- Lou Pecora,   my views are my own.
---------------
"I knew I was going to take the wrong train, so I left early." 
--Yogi Berra


 
____________________________________________________________________________________
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121



More information about the NumPy-Discussion mailing list