Newbie question about numpy

Robert Kern robert.kern at gmail.com
Thu Aug 24 12:15:38 EDT 2006


Paul Johnston wrote:
> Hi I'm new to python and have just been taking a look at what it has
> to offer.
> I noted the lack of matrices so installed numpy

You will want to ask numpy questions on the numpy list.

   http://www.scipy.org/Mailing_Lists

numpy arrays are not matrices; they are arrays. All of the arithmetic operations 
on them are done element-wise. The dot() function will do matrix multiplication.

There is a matrix class (with the constructor numpy.mat(some_array)) that 
derives from arrays and overrides the * operator to do matrix multiplication if 
that is what you want. I prefer using dot() on regular arrays, myself.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list