Skip to content

Commit 7eee20d

Browse files
rgommerskgryte
andauthored
Add complex number support to vecdot (#512)
* Add complex number support to `vecdot` Closes gh-356 (where the definition x1^H x2 was decided). * Move operation description to extended intro * Fix equation * Update equation * Update copy * Fix equation * Fix equation * Remove note * Add linebreak * Update copy Co-authored-by: Athan <[email protected]>
1 parent b3f2829 commit 7eee20d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

spec/API_specification/array_api/linear_algebra_functions.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,20 @@ def tensordot(x1: array, x2: array, /, *, axes: Union[int, Tuple[Sequence[int],
9797
def vecdot(x1: array, x2: array, /, *, axis: int = -1) -> array:
9898
"""
9999
Computes the (vector) dot product of two arrays.
100+
101+
Let :math:`\mathbf{a}` be a vector in ``x1`` and :math:`\mathbf{b}` be a corresponding vector in ``x2``. The dot product is defined as
102+
103+
.. math::
104+
\mathbf{a} \cdot \mathbf{b} = \sum_{i=0}^{n-1} a_i\overline{b_i}
105+
106+
over the dimension specified by ``axis`` and where :math:`n` is the dimension size and :math:`\overline{b_i}` denotes the complex conjugate if :math:`b_i` is complex and the identity if :math:`b_i` is real-valued.
100107
101108
Parameters
102109
----------
103110
x1: array
104-
first input array. Should have a real-valued data type.
111+
first input array. Should have a floating-point data type.
105112
x2: array
106-
second input array. Must be compatible with ``x1`` for all non-contracted axes (see :ref:`broadcasting`). The size of the axis over which to compute the dot product must be the same size as the respective axis in ``x1``. Should have a real-valued data type.
113+
second input array. Must be compatible with ``x1`` for all non-contracted axes (see :ref:`broadcasting`). The size of the axis over which to compute the dot product must be the same size as the respective axis in ``x1``. Should have a floating-point data type.
107114
108115
.. note::
109116
The contracted axis (dimension) must not be broadcasted.

0 commit comments

Comments
 (0)