RFC: add `cbrt`
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
- python
- Domain
- api, backend-api-design
Research direction
Review the existing pow and sqrt definitions in src/array_api_stubs/_2022_12/elementwise_functions.py and the cbrt availability data in common_apis.csv. Compare the proposed signature and IEEE 754 rationale with the linked prior art. Done means the RFC is resolved and the Array API specification has a decided position on adding cbrt.
Written by the indexing model from the issue text.
Description
This RFC requests to include a new API in the array API specification for the purpose of computing the cube root.
Overview
Based on array comparison data, the API is available in the majority of libraries in the PyData ecosystem.
The Array API Specification currently includes pow and sqrt, but does not include the IEEE 754 function cbrt.
While the cube root could be implemented in terms of pow, this is not desirable as the rational 1/3 is not typically equal to 1.0/3.0 due to limited floating-point precision. Cube root implementations are generally more accurate than the equivalent operation via pow.
Prior art
- NumPy: https://numpy.org/doc/stable/reference/generated/numpy.cbrt.html
- PyTorch: (not currently implemented)
- MXNet: https://mxnet.apache.org/versions/master/api/python/docs/api/np/generated/mxnet.np.cbrt.html
- TensorFlow: https://www.tensorflow.org/api_docs/python/tf/experimental/numpy/cbrt
- C99: https://en.cppreference.com/w/c/numeric/math/cbrt
Proposal:
def cbrt(x: array, /) -> array
cc @kgryte
- 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