[Numpy-discussion] NumPy re-factoring project

Pauli Virtanen pav@iki...
Fri Jun 11 03:38:28 CDT 2010


Fri, 11 Jun 2010 10:29:28 +0200, Hans Meine wrote:
[clip]
> Ideally, algorithms would get wrapped in between two additional
> pre-/postprocessing steps:
> 
> 1) Preprocessing: After broadcasting, transpose the input arrays such
> that they become C order.  More specifically, sort the strides of one
> (e.g. the first/the largest) input array decreasingly, and apply the
> same transposition to the other arrays (in + out if given).
> 
> 2) Perform the actual algorithm, producing a C-order output array.
> 
> 3) Apply the reverse transposition to the output array.
[clip]

The post/preprocessing steps are fairly easy to implement in the ufunc 
machinery.

The problem here was that this would result to a subtle semantic change, 
as output arrays from ufuncs would no longer necessarily be in C order.

We need to explicitly to *decide* to make this change, before proceeding. 
I'd say that we should simply do this, as nobody should depend on this 
assumption.

I think I there was some code ready to implement this shuffling. I'll try 
to dig it out and implement the shuffling.

-- 
Pauli Virtanen



More information about the NumPy-Discussion mailing list