The "dot" or "inner" product has an expanded definition in tensor algebra compared to linear algebra.
For n and m dimensional tensors N and M, N⋅M will have dimension (n + m - 2), as the "inner dimensions" (last dimension of N and first dimension of M) will be summed over after multiplication.
(as an aside, N.dot(M) actually sums over the last dimension of N and the second-last dimension of M, because . . . reasons. The actual tensor algebra "dot product" functionality is relegated to np.tensordot)
For n = m = 1 (i.e. both are 1-d tensors, or "vectors"), the output is a 0-d tensor, or "scalar", and this is equivalent to the "scalar" or "dot" product from linear algebra.
For n = m = 2 (i.e. both are 2-d tensors, or "matrices"), the output is a 2-d tensor, or "matrix", and the operation is eqivalent to "matrix multiplication".
And for n = 2, m = 1, the output is a 1d tensor, or "vector", and this is called (at least by my professors) "mapping."
Note that since the order of dimensions is relevent to the construction of the inner product,
N.dot(M) == M.dot(N)
is not generally True unless n = m = 1 - i.e. only in the case of the scalar product.
np.dotdoes produce a scalar - when the inputs are 1d arrays. The conventional matrix multiplication is defined for 2d arrays. But what's the definition, and name, for 3d or mix of dimensions? There is a new name -np.matmul. And for even greater generality there'sEinstein notation,np.einsum. - hpauljnandmdimensional arrays, or "tensors"NandM,N.dot(M)will have dimension(n + m - 2). (as the first dimension ofNand last dimension ofMwill be summed over). Forn = m = 1, the output is a 0-d tensor, or scalar, and this is called a "scalar product". Forn = m = 2, the output is a 2-d tensor, or "matrix", and the operation is called "matrix multiplication". And forn = 2, m = 1, the output is a 1d tensor, or "vector", and this is called (at least by my professors) "mapping." - Daniel F