Discussion: new operators for numerical computation

Travis Oliphant olipt at mayo.edu
Fri Jul 21 10:11:36 EDT 2000


> The cleanest concept (in my opinion) is the one implemented in J,
> where an array has (conceptually) a "data rank" and a "value rank",
> the sum of the two being the rank, i.e. the number of indices. For
> example, an array of rank 3 could be interpreted as a list of matrices
> (data rank 1, value rank 2), as a matrix of vectors (data rank 2,
> value rank 1), or as a 3-d array of scalars (data rank 3, value rank
> 0). In J the data and value ranks are not properties of the arrays,
> but of the operators, whose value rank can be modified. In the early
> days of NumPy development, I proposed this model for NumPy as well,
> but there was no majority for it. And I agree that there are not so
> many practical cases where this mechanism is necessary. However,
> it nicely illustrates how one would extend vector and matrix operations
> to higher-dimensional data.

I like this idea also.  Would you suggest changes to the syntax so that
infix operators can have ranks?  It could also be handled by functions
(add, mul, etc..) or methods which return a subclass of the N-D Array
which does the right thing when it sees the standard operator.  I vaguely
remember reading about this proposal.  I didn't notice that much
disagreement, but I don't think I ever saw any code.

-Travis




More information about the Python-list mailing list