[Python-ideas] [RFC] draft PEP: Dedicated infix operators for matrix multiplication and matrix power

Sturla Molden sturla.molden at gmail.com
Mon Mar 17 09:54:34 CET 2014


"M.-A. Lemburg" <mal at egenix.com> wrote:

>> Indeed. Numpy already uses a .T property for this.
> 
> Ah, good trick :-)

It is a better trick than you would expect. 

Matlab and Fortran matrix transpose has complexity O(M*N) for a rank M x N
matrix.

NumPy's .T attribute has complexity O(1)

With Numpy, we can put .T into matrix expressions with impunity. Now THAT
is a good trick :-)

I am not aware of any other system where memory access is so flexible that
matrix transposition can be done in O(1) time.


Regards,
Sturla



More information about the Python-ideas mailing list