10000 DOC: Changed vdot docs as suggested by geetaakshata · Pull Request #26406 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

DOC: Changed vdot docs as suggested #26406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions numpy/_core/multiarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not needed after all.

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 <https://en.wikipedia.org/wiki/Frobenius_inner_product>`_
(also known as the *trace inner product* or the *standard inner product*
on a vector space of matrices).

Parameters
----------
Expand Down Expand Up @@ -883,7 +887,7 @@ def vdot(a, b):
>>> 1*4 + 4*1 + 5*2 + 6*2
30

"""
""" # noqa: E501
Copy link
Contributor
@mdhaber mdhaber Oct 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only needed for the URL. Perhaps Sphinx would allow a line break there, but I wasn't sure.

return (a, b)


Expand Down
0