numpy.linalg.matmul#

linalg.matmul(x1, x2, /)[source]#

Computes the matrix product.

This function is Array API compatible, contrary to numpy.matmul.

Parameters:
x1array_like

The first input array.

x2array_like

The second input array.

Returns:
outndarray

The matrix product of the inputs. This is a scalar only when both x1, x2 are 1-d vectors.

Raises:
ValueError

If the last dimension of x1 is not the same size as the second-to-last dimension of x2.

If a scalar value is passed in.

See also

numpy.matmul