[Numpy-discussion] numarray interface and performance issues (for dot product and transpose)

Warren Focke focke at SLAC.Stanford.EDU
Fri Mar 1 17:53:10 CST 2002

On Thu, 28 Feb 2002, Tim Hochberg wrote:
> >    not going to do you any good). The above C' * C actually creates,
> >    _3_ versions of C, 2 of them transposed (prior to 20.3;
> I think you're a little off track here. The transpose operation doesn't
> normally make a copy, it just creates a new object that points to the same
> data, but with different stride values. So the transpose shouldn't be slow
> or take up more space.

Numeric.transpose quickly returns an object which takes up little space.
But, in many cases, when you actually use the object returned, a
contiguous copy gets created.  Glancing over the 21.0b3 sources, it looks
like this might not happen as often as it used to, but there are still
plenty of calls to PyArray_ContiguousFromObject in there, so transposition
is not always as cheap as it might seem.  Especially if you say
Aprime=Numeric.transpose(A) and then use Aprime several times, you could
end up repeatedly creating and discarding temporary transposed copies.

Warren Focke

More information about the Numpy-discussion mailing list