Skip to content

Commit 83c34d5

Browse files
authored
Merge pull request numpy#26406 from geetaakshata/main
DOC: Changed vdot docs as suggested
2 parents 6f63230 + d9517e3 commit 83c34d5

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

numpy/_core/multiarray.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -830,18 +830,22 @@ def dot(a, b, out=None):
830830

831831
@array_function_from_c_func_and_dispatcher(_multiarray_umath.vdot)
832832
def vdot(a, b):
833-
"""
833+
r"""
834834
vdot(a, b, /)
835835
836836
Return the dot product of two vectors.
837837
838-
The vdot(`a`, `b`) function handles complex numbers differently than
839-
dot(`a`, `b`). If the first argument is complex the complex conjugate
840-
of the first argument is used for the calculation of the dot product.
838+
The `vdot` function handles complex numbers differently than `dot`:
839+
if the first argument is complex, it is replaced by its complex conjugate
840+
in the dot product calculation. `vdot` also handles multidimensional
841+
arrays differently than `dot`: it does not perform a matrix product, but
842+
flattens the arguments to 1-D arrays before taking a vector dot product.
841843
842-
Note that `vdot` handles multidimensional arrays differently than `dot`:
843-
it does *not* perform a matrix product, but flattens input arguments
844-
to 1-D vectors first. Consequently, it should only be used for vectors.
844+
Consequently, when the arguments are 2-D arrays of the same shape, this
845+
function effectively returns their
846+
`Frobenius inner product <https://en.wikipedia.org/wiki/Frobenius_inner_product>`_
847+
(also known as the *trace inner product* or the *standard inner product*
848+
on a vector space of matrices).
845849
846850
Parameters
847851
----------
@@ -883,7 +887,7 @@ def vdot(a, b):
883887
>>> 1*4 + 4*1 + 5*2 + 6*2
884888
30
885889
886-
"""
890+
""" # noqa: E501
887891
return (a, b)
888892

889893

0 commit comments

Comments
 (0)