0

I have the following variables:

A of dimensions [126 X 3] B of dimensions [3 x 2]

what is the python equivalent of the matlab multipication C = A*B'

C is a matrix of dimension [126 x 2]

gabboshow
  • 5,359
  • 12
  • 48
  • 98
  • 1
    numpy.dot or numpy.matmul https://docs.scipy.org/doc/numpy/reference/generated/numpy.matmul.html – Marco Apr 24 '17 at 10:12
  • Possible duplicate of [how does multiplication differ for NumPy Matrix vs Array classes?](http://stackoverflow.com/questions/3890621/how-does-multiplication-differ-for-numpy-matrix-vs-array-classes) – m0nhawk Apr 24 '17 at 11:33

2 Answers2

2
import numpy as np

c = np.dot(a, b)
McN
  • 63
  • 6
1

For Python 3.5 or later, you can use the @ matrix multiplication operator:

C = A@B
TheBlackCat
  • 9,791
  • 3
  • 24
  • 31