Fix Python – how does multiplication differ for NumPy Matrix vs Array classes?

Question

Asked By – elexhobby

The numpy docs recommend using array instead of matrix for working with matrices. However, unlike octave (which I was using till recently), * doesn’t perform matrix multiplication, you need to use the function matrixmultipy(). I feel this makes the code very unreadable.

Does anybody share my views, and has found a solution?

Now we will see solution for issue: how does multiplication differ for NumPy Matrix vs Array classes?


Answer

In 3.5, Python finally got a matrix multiplication operator. The syntax is a @ b.

This question is answered By – Petr Viktorin

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0