Skip to main content

dot

Dot product of two arrays. For 1-D arrays, computes the inner product. For 2-D arrays, computes the matrix product (equivalent to matmul). For higher dimensions, a sum product over the last axis of a and the second-to-last axis of b. Also available as np.linalg.dot(...).
Returns: NDArray | number — Scalar if both inputs are 1-D, otherwise an NDArray.

matmul

Matrix product of two arrays. This is the equivalent of the @ operator in NumPy/Python. Unlike dot, matmul does not allow scalar multiplication and follows strict broadcasting rules for stacks of matrices. Also available as np.linalg.matmul(...).
Returns: NDArray — The matrix product.

inner

Inner product of two arrays. For 1-D arrays, this is identical to dot. For higher-dimensional arrays, it is a sum product over the last axes. Also available as np.linalg.inner(...).
Returns: NDArray | number — Scalar if both inputs are 1-D, otherwise an NDArray.

outer

Compute the outer product of two vectors. The inputs are flattened if they are not already 1-D. Also available as np.linalg.outer(...).
Returns: NDArray — 2-D array of shape [a.size, b.size] where out[i, j] = a[i] * b[j].

tensordot

Compute tensor dot product along specified axes. Generalizes dot for higher-dimensional arrays. Also available as np.linalg.tensordot(...).
Returns: NDArray — The tensor dot product.

kron

Kronecker product of two arrays. The result is a block matrix formed by multiplying every element of a by the entirety of b.
Returns: NDArray — The Kronecker product.

vdot

Vector dot product. Flattens both inputs to 1-D before computing the dot product. For complex arrays, the complex conjugate of a is used.
Returns: number — Scalar dot product of the flattened inputs.

vecdot

Vector dot product along the specified axis. Unlike vdot, this operates along a given axis rather than flattening. Also available as np.linalg.vecdot(...).
Returns: NDArray — Dot product computed along the given axis.

matvec

Matrix-vector product. Multiplies a matrix by a vector, equivalent to matmul(a, b) where b is 1-D. Also available as np.linalg.matvec(...).
Returns: NDArray — The matrix-vector product.

vecmat

Vector-matrix product. Multiplies a vector by a matrix, equivalent to matmul(a, b) where a is 1-D. Also available as np.linalg.vecmat(...).
Returns: NDArray — The vector-matrix product.

einsum

Evaluates the Einstein summation convention on the operands. This is a powerful generalization that can express many common linear algebra operations in a single call.
Returns: NDArray — The result of the Einstein summation.

einsum_path

Evaluate the optimal contraction order for an einsum expression. Returns the path and a human-readable description of the optimization.
Returns: [string[], string] — A tuple of the contraction path (list of index pairs) and a printable description of the optimization.