Only pay attention :
*
, stay np.array Element multiplication is overloaded in , stay np.matrix Matrix multiplication is overloaded in !
Be careful :
about Array Formatted data , A one-dimensional 、 Two dimensional arrays can use elements 、 matrix multiplication ;
about matrix Formatted data , One dimensional matrix can only be multiplied by elements , Two dimensional matrices are OK .
Two dimensional array
One dimensional array
Two dimensional array
One dimensional array
Two dimensional array
One dimensional array ( Multiply the corresponding positions , And then sum up )
Two dimensional matrix
One dimensional matrix
Two dimensional matrix
One dimensional matrix
Two dimensional matrix
One dimensional matrix ( Report errors , Matrix operations cannot be performed directly )
Reference resources :
Numpy Matrix vector multiplication in
python in np.multiply()、np.dot() And asterisk (*) The difference between the three multiplication operations