Feb. 3, 2010
8:20 a.m.
laurent.feron@free.fr wrote:
Hello,
if i multiply two matrix, one with a unique line and the second one with a unique column, i should have a scalar:
line matrix([[1, 3, 1]]) col matrix([[2], [2], [2]]) line*col matrix([[10]])
Matlab give me a scalar, Numpy does not...
Matlab does not have the concept of scalar: everything is a matrix (size(1) returns (1, 1) in matlab). NumPy matrix objects are more or less the same: every operation between two matrices return a matrix. Although natural coming from a matlab background, I would advise against using matrices because they look more familiar. I did the same mistake when I started using NumPy, and getting used to NumPy arrays took me more time. cheers, David