[Numpy-discussion] Please chime in on proposed methods for arrays
oliphant at ee.byu.edu
Wed Mar 16 20:27:29 CST 2005
One item I have not received a lot of feedback on is the new proposal
for a greatly increased number of methods on the ndarray.
The current PEP has a listing of all the proposed methods and attributes
(some more were added after consulting current numarray in more detail
and looking at all the functions in current Numeric.py)
If a function call essentially involved an arrayobject with some other
parameters then it was turned into a method. If it involved two "equal"
arrays then it was left as a function. This is a somewhat arbitrary
convention, and so I am asking for suggestions as to what should be methods.
Should all the ufuncs be methods as well? I think Konrad suggested
this. What is the opinion of others?
The move from functions to methods will mean that some of the function
calls currently in Numeric.py will be redundant, but I think they should
stay there for backwards compatibility, (perhaps with a deprecation
A final question:
I think we need to think carefully about multidimensional indexing so
that it replaces current usage of take, put, putmask.
For example, how, in numarray would you replace
take(a,[1,5,10],axis=-2) if a is a 10x20x30 array?
Note that in this case take returns a 10x3x30 array (call it g) with
g[:,0,:] = a[:,1,:]
g[:,1,:] = a[:,5,:]
g[:,2,:] = a[:,10,:]
I submit that a[...,[1,5,10],:] would be an appropriate syntax. This
would mean changing the current PEP a bit.
More information about the Numpy-discussion