Skip to content

Commit

Permalink
Conjugate the first argument in vecdot
Browse files Browse the repository at this point in the history
Note that PyTorch uses its own vecdot directly for complex inputs,, which
already does conjugation.

This is currently untested by the test suite (data-apis/array-api-tests#312)

Fixes data-apis#200.
  • Loading branch information
asmeurer committed Nov 19, 2024
1 parent 8d3f5d5 commit 07043a0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion array_api_compat/common/_aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def vecdot(x1: ndarray, x2: ndarray, /, xp, *, axis: int = -1) -> ndarray:
x2_ = xp.moveaxis(x2, axis, -1)
x1_, x2_ = _broadcast(x1_, x2_)

res = x1_[..., None, :] @ x2_[..., None]
res = xp.conj(x1_[..., None, :]) @ x2_[..., None]
return res[..., 0, 0]

# isdtype is a new function in the 2022.12 array API specification.
Expand Down

0 comments on commit 07043a0

Please sign in to comment.