[Numpy-discussion] .T Transpose shortcut for arrays again
Christopher Barker
Chris.Barker at noaa.gov
Fri Jul 7 13:11:22 CDT 2006
Robert Kern wrote:
> Just
> because linear algebra is "the base" for a lot of numerical computing does not
> mean that everyone is using numpy arrays for linear algebra all the time. Much
> less does it mean that all of those conventions you've devised should be shoved
> into the core array type.
I totally agree here. What bugged me most about MATLAB was that it was
so darn Matrix/Linear Algebra centric.
Yes, much of the code I wrote used linear algebra, but mostly it was a
tiny (though critical) part of the actual code: Lots of code to set up a
matrix equation, then solve it. The solve it was one line of code. For
the rest, I prefer an array approach.
A Matrix/Linear Algebra centric approach is good for some things, but I
think it should be all or nothing. If you want it, then there should be
a Matrix package, that includes the Matrix object, AND a matrix version
of all the utility functions, like ones, zeros, etc. So all you would
have to do is do:
from numpy.matrix import *
instead of
from numpy import *
and you'd get all the same stuff.
Most of what would need to be added to the matrix package would be
pretty easy, boiler plate code. Then we'd need a bunch more testing to
root out all the operations that returned arrays where they should
return matrices.
If there is no one that wants to do all that work, then we have our answer.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the Numpy-discussion
mailing list