`xp.vecdot` output arrayness depends on NumPy version
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start by reproducing the reported xp.vecdot behavior with NumPy versions below and above 2.0, then inspect the compatibility implementation for xp.vecdot. Confirm the chosen return type against the Array API requirement and add or update coverage for both version ranges; done means consistent behavior across them.
Written by the indexing model from the issue text.
Description
With NumPy >= 2.0:
import numpy as np
from scipy._lib._array_api import array_namespace
x1 = np.asarray([0.667, 0.667, 0.667])
x2 = np.asarray([0.123, 0.456, 0.789])
xp = array_namespace(x1, x2)
xp.vecdot(x1, x2)
# np.float64(0.912456)
With NumPy < 2.0, the result is a 0d array.
I'd suggest that array-api-compat should either:
- make modern NumPy produce an array (for compliance with the standard) or
- make old NumPy produce a NumPy float (for consistency with all NumPy functions).
The latter would be my preference for now. (Actually fixing NumPy would be the long term preference - https://github.com/mdhaber/numpy/pull/2).
- Dominant language
- Python
- Stars
- 131
- Forks
- 49
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 6
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from data-apis/array-api-compat
-
blocked by upstream
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
data-apis/array-api-compat#439 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
data-apis/array-api-compat#395 · 2 comments ·
-
Release 1.16 Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
data-apis/array-api-compat#476 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
data-apis/array-api-compat#473 · 4 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
data-apis/array-api-compat#465 · 3 comments ·
All issues in data-apis/array-api-compat
Similar issues
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
simonw/sqlite-utils#872 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100