[SciPy-user] numarray interface and performance issues (for dot product and transpose)
eric at scipy.org
Fri Mar 1 14:47:48 CST 2002
> > - a.Transpose() -> makes a copy and returns a normal array with the
> > transposed. Any routine which can handle a numpy array can handle this.
> Hmm, interestingly you are the only one who picked up on the lazy copying
> theme so far, apart from another poster who suggested that no unnecessary
> copies are created anyway (I have no time to check that right now,
Numeric does not make a copy during transpose. It changes values in the stride
and dimensions fields of the C array structure to create a "virtual transpose".
Note that this does break the contiguity of your matrix in memory. If you want
to force an actual memory transpose (which I know you do not), you can use
tranpose(a).copy(). This will return a new, contiguous array with the elements
reordered. There isn't a way to do this in place as far as I know.
So, as far as transpose goes, Numeric is already doing what you are asking. The
speed loss your seeing is due to other issues.
More information about the SciPy-user