No subject

Thu Nov 16 16:52:29 CST 2006

things. A function written for matrix objects cannot be expected to
work with array objects, and vice versa. Matrix operations should
return matrix objects, and array operations should return array

What arrays and matrices have in common is not semantics, but
implementation. That is something that implementors should profit
from, but users shouldn't even need to know about.

The discussion about matrices has focused on matrix multiplication as
the main difference between the two objects. I suppose this was
motivated by comparisons to Matlab and similar environments, which do
not have the notion of data types and thus cannot properly distinguish
between matrices and arrays. I don't see why should follow this
limited approach.

A matrix object should not only do matrix multiplication properly, but
also provide methods such as diagonalization, application of functions
as matrix functions, etc. That would be much more than syntactic
sugar, it would be a real implementation of the mathematical concept

Seen from this point of view, it is not at all clear why an array
should have an attribute that is an "equivalent" matrix, as no such
equivalence exists in general (only for 2D arrays).

> Conceivably there will be modules useful for both kinds of objects. Do

I don't think so. The only analogous operations between arrays and
matrices are addition, subtraction, negation, and multiplication with
a scalar, and those would use the same syntax anyway.

Konrad Hinsen                            | E-Mail: hinsen at
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-
Rue Charles Sadron                       | Fax:  +33-
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais

More information about the Numpy-discussion mailing list