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

Charles G Waldman cgw at alum.mit.edu
Thu Feb 28 14:24:02 CST 2002


A.Schmolck writes:
 > 
 > Two essential matrix operations (matrix-multiplication and transposition
 > (which is what I am mainly using) are both considerably
 > 
 > a) less efficient and
 > b) less notationally elegant

Your comments about efficiency are well-taken.

I have (in a previous life) done work on efficient (in terms of
virtual memory access / paging behavior) transposes of large arrays.
(Divide and conquer).  Anyhow - if there were support for the
operation of A*B' (and A'*B) at the C level, you wouldn't need to ever
actually have a copy of the transposed array in memory - you would
just exchange the roles of "i" and "j" in the computation...

 > 3. Wrap: create a DotMatrix class that overloads '*' to be dot and maybe
 >    self.t to return the transpose -- this also means that all the numerical
 >    libraries I frequently use need to be wrapped.

I guess you haven't yet stumbled across the Matrix.py that comes with
Numeric - it overrides "*" to be the dot-product.

Unfortunately I don't see a really easy way to simplify the Transpose
operator -  at the very least you could do
T = Numeric.transpose
and then you're just writing T(A) instead of the long-winded version.

Interestingly, the "~" operator is available, but it calls the
function "__invert__".  I guess it would be too weird to have ~A
denote the transpose?  Right now you get an error - one could set
things up so that ~A was the matrix inverse of A, but we already have
the A**-1 notation (among others) for that...



More information about the SciPy-user mailing list