From 4dfc89032402fc07201f9fd240d9cbdf804f496b Mon Sep 17 00:00:00 2001 From: Dreamge Date: Thu, 9 May 2024 00:08:58 -0700 Subject: [PATCH 1/3] changed vdot docs as suggested --- numpy/_core/multiarray.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/numpy/_core/multiarray.py b/numpy/_core/multiarray.py index 27c2662c6a61..35c9eea4eb98 100644 --- a/numpy/_core/multiarray.py +++ b/numpy/_core/multiarray.py @@ -851,9 +851,11 @@ def vdot(a, b): 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. - 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. + 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. + The runtime of this function is linear in `a.size` and `b.size`. When `(a, b)` are 2-D arrays + of the same shape, this function returns their `Frobenius inner-product` (also known as the + *trace inner product* or the *standard inner product* on a vector space of matrices). Parameters ---------- From 346f5fa73ac7d7f5cd91dd063b6b476f6166467a Mon Sep 17 00:00:00 2001 From: Matt Haberland Date: Fri, 11 Oct 2024 18:00:15 -0700 Subject: [PATCH 2/3] DOC: vdot: adjustments per review --- numpy/_core/multiarray.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/numpy/_core/multiarray.py b/numpy/_core/multiarray.py index 35c9eea4eb98..ca5dbf287cb8 100644 --- a/numpy/_core/multiarray.py +++ b/numpy/_core/multiarray.py @@ -842,20 +842,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. - The runtime of this function is linear in `a.size` and `b.size`. When `(a, b)` are 2-D arrays - of the same shape, this function returns their `Frobenius inner-product` (also known as the - *trace inner product* or the *standard inner product* on a vector space of matrices). + 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 ---------- @@ -896,7 +898,7 @@ def vdot(a, b): >>> 1*4 + 4*1 + 5*2 + 6*2 30 - """ + """ # noqa: E501 return (a, b) From d9517e3dcea504099bea1b7df4bd7e75d2958061 Mon Sep 17 00:00:00 2001 From: Matti Picus Date: Sat, 12 Oct 2024 21:51:29 +0300 Subject: [PATCH 3/3] remove extraneious '.' [skip azp][skip actions][skip cirrus] Co-authored-by: Matt Haberland --- numpy/_core/multiarray.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numpy/_core/multiarray.py b/numpy/_core/multiarray.py index 95d8b194a45e..2c604e1d8897 100644 --- a/numpy/_core/multiarray.py +++ b/numpy/_core/multiarray.py @@ -843,7 +843,7 @@ def vdot(a, b): Consequently, when the arguments are 2-D arrays of the same shape, this function effectively returns their - `Frobenius inner product `_. + `Frobenius inner product `_ (also known as the *trace inner product* or the *standard inner product* on a vector space of matrices).