Differences Between Arrays and Matrices in Numpy

Nobody nobody at nowhere.com
Thu Jul 30 00:21:27 CEST 2009


On Wed, 29 Jul 2009 16:23:33 -0400, Nanime Puloski wrote:

> What are some differences between arrays and matrices using the Numpy
> library?

Matrices are always two-dimensional, as are slices of them. Matrices
override mulitplication and exponentiation to use matrix multiplication
rather than element-wise multiplication.

> When would I want to use arrays instead of matrices and vice
> versa?

Use a matrix if you want a matrix, i.e. a linear transformation.
Otherwise, use an array.




More information about the Python-list mailing list