Preferences regarding "core dimension"
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- numpy, python
- Domain
- data, documentation
Research direction
Start by reading the array API specification's broadcasting guidance and the linked NumPy gufunc and SciPy sph_harm_y_all documentation. Compare front- and back-oriented core dimensions, then document a recommendation and its rationale for broadcasting and memory layout.
Written by the indexing model from the issue text.
Description
I always wonder how to design a vectorizable function when the sizes of the input and output arrays are different.
In other words, I am always unsure whether to shift the “core dimension” to the back
def polar_coordinates(r, theta):
xp = array_api_compat(r, theta)
return xp.stack([r * xp.cos(theta), r * xp.sin(theta)], axis=-1)
or to the front
def polar_coordinates(r, theta):
xp = array_api_compat(r, theta)
return xp.stack([r * xp.cos(theta), r * xp.sin(theta)], axis=0)
Is there any plans to add recommendations for this to array API? For reference
-
Numpy's gufunc puts "core dimension" to the back https://numpy.org/doc/stable/reference/c-api/generalized-ufuncs.html
-
Recently added
scipy.special.sph_harm_y_allputs "core dimension" to the front https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.sph_harm_y_all.html -
Since
broadcastingadjusts shapes to the back, by putting "core dimension" to the back one can more easily interact with newly added feature (dimension), and vice versa. -
In terms of calculation speed, this should be related to C-style and Fortran-style indexing.
- Dominant language
- Python
- Stars
- 281
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
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
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Maintenance
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
All issues in data-apis/array-api
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