[Numpy-discussion] [IPython-dev] Discussion with Guido van Rossum and (hopefully) core python-dev on scientific Python and Python3

Chris Barker chris.barker@noaa....
Tue Feb 14 17:12:55 CST 2012


On Tue, Feb 14, 2012 at 9:16 AM, Dag Sverre Seljebotn
<d.s.seljebotn@astro.uio.no> wrote:
> It was about the need for a dedicated matrix multiplication operator.

has anyone proposed that? I do think we've had a proposal on the table
for generally more operators: i.e. like matlab's ".*" vs "*", and yes,
matrix multiplication would be one use of that feature.

> (The difference from the current
> situation being that people avoid np.matrix because it's so similar to
> np.ndarray that you too easily get confused).

I'm not sure that's why -- I think it's because:

a) np.matrix is really not quite finished - it's not full featured
enough to be truly useful (maybe that's the same as you "similar to
np.ndarray)"

b) all it provides is syntax candy for matrix operations -- and how
much of our code is matricx operations? a couple lines our of hundreds
(that was always the case with my MATLAB code, and it even the more so
now -- I can count my uses of np.dot on one hand...)

> I myself never missed a matrix multiplication operator, precisely
> because my matrices are very often diagonal or triangular or sparse or
> something else, so having syntax candy simply to invoke np.dot wouldn't
> help me.

exactly -- so that could address point (a), but I still think in most
code it's only going to amke a small fraction of teh code more
readable.

-Chris

PS: the notable exception is instructional code involving matrix
arithmetic -- it would be nice there, and that is where I've seen the
strongest requests for it.



-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the NumPy-Discussion mailing list