diff --git a/numpy/_core/multiarray.py b/numpy/_core/multiarray.py index 985edc869f91..2c604e1d8897 100644 --- a/numpy/_core/multiarray.py +++ b/numpy/_core/multiarray.py @@ -830,18 +830,22 @@ def dot(a, b, out=None): @array_function_from_c_func_and_dispatcher(_multiarray_umath.vdot) def vdot(a, b): - """ + r""" vdot(a, b, /) Return the dot product of two vectors. - The vdot(`a`, `b`) function handles complex numbers differently than - dot(`a`, `b`). If the first argument is complex the complex conjugate - of the first argument is used for the calculation of the dot product. + The `vdot` function handles complex numbers differently than `dot`: + if the first argument is complex, it is replaced by its complex conjugate + in the dot product calculation. `vdot` also handles multidimensional + arrays differently than `dot`: it does not perform a matrix product, but + flattens the arguments to 1-D arrays before taking a vector dot product. - Note that `vdot` handles multidimensional arrays differently than `dot`: - it does *not* perform a matrix product, but flattens input arguments - to 1-D vectors first. Consequently, it should only be used for vectors. + Consequently, when the arguments are 2-D arrays of the same shape, this + function effectively returns their + `Frobenius inner product `_ + (also known as the *trace inner product* or the *standard inner product* + on a vector space of matrices). Parameters ---------- @@ -883,7 +887,7 @@ def vdot(a, b): >>> 1*4 + 4*1 + 5*2 + 6*2 30 - """ + """ # noqa: E501 return (a, b)