I want to compute matrix multiplication in the mathematical sense with Python. A matrix with m
rows and n
columns multiplied by a matrix with n
rows and m
columns gives a matrix with m
rows and m
columns. I used the operator *
incorrectly at first and got unexpected results. I later learned that the operator @
is what I need. So what is the difference between these two operators for matrix operations in Python?
CodePudding user response:
*
is an element wise multiplication and @
is a matrix or dot product.
CodePudding user response: