[Numpy-discussion] Selecting columns of a matrix

Simon Burton simon at arrowtheory.com
Thu Jun 22 06:19:05 CDT 2006


On Wed, 21 Jun 2006 10:50:26 -0600
Travis Oliphant <oliphant.travis at ieee.org> wrote:

> 
> So, in SVN NumPy, you will be able to do
> 
> a[:,V>0]
> a[V>0,:] 
> 
> The V>0 will be replaced with integer arrays as if nonzero(V>0) had been 
> called.

OK.
But just for the record, we should note how to
do the operation that this used to do, eg.

>>> a=numpy.array([1,2])
>>> a[[numpy.bool_(1)]]
array([2])
>>> 

This could be a way of, say, maping a large
boolean array onto some other values (1 or 2 in the
above case).

So, with the new implementation, is it possible to cast
the bool array to an integer type without incurring a copy overhead ?

And finally, is someone keeping track of the performance
of array getitem ? It seems that as travis overloads it more and
more it might then slow down in some cases.

I must admit my vision is blurring and head is spining as numpy 
goes through these growing pains. I hope it's over soon. Not
because I have trouble keeping up (although i do) but it's
my matlab/R/numarray entrenched co-workers who cannot
be exposed to this unstable development (they will run
screaming to the woods).

cheers,

Simon.

-- 
Simon Burton, B.Sc.
Licensed PO Box 8066
ANU Canberra 2601
Australia
Ph. 61 02 6249 6940
http://arrowtheory.com 




More information about the Numpy-discussion mailing list