[Numpy-discussion] Matrix vs ndarray

Alan G Isaac aisaac@american....
Thu Apr 17 14:16:43 CDT 2008


On Thu, 17 Apr 2008, Santanu Chatterjee apparently wrote:
> 1) What is the difference between ndarray and matrix in 
> numpy? My idea is that having N-dimensional array is 
> sufficient (of course a MATLAB users point of view). If 
> anyone can provide some idea, I will appreciate it. 

Matrices are 2d only.
The * are ** operators have matrix definitions
instead of element-by-element definitions.
Matrix subarrays are always 2d ...
Matrices have an A attribute to return an array view of the data.
(Useful for element by element operations.)

hth,
Alan Isaac





More information about the Numpy-discussion mailing list