[SciPy-user] Mathematica Element-wise Multiplication

Alan G Isaac aisaac@american....
Mon Dec 17 07:04:01 CST 2007

On Sun, 16 Dec 2007, Johann Cohen-Tanugi apparently wrote:
> Assuming that this natural linear algebra could be 
> retrieved when, and only when, the array is 1D 

You appear to be talking about a "natural" linear algebra 
for 2D objects.  For example, when textbooks talk of row 
vectors and column vectors, they are talking about 2D 
objects, even though they use a simplified indexing.  (This 
vocabulary is only slightly misleading: after all, matrices 
of a given dimension are also vectors and can be indexed 
with a single index---Matlab allows this (column major) and 
NumPy allows this too (row major, via the `flat` 

If that is what you always seek, stick with matrices::

            >>> x=numpy.mat([0,1,2])
            >>> x
            matrix([[0, 1, 2]])
            >>> x.T

In the meantime, you can always add an axis if you wish::

>>> x
array([0, 1, 2])
>>> y=x[:,None]
>>> y

Alan Isaac

More information about the SciPy-user mailing list