How to infer appropriate `dtype` from `uint` to `int` and `float` to `complex`?
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Review the linked type-promotion rules alongside the f and g examples; determine whether the standard already defines a dtype inference mechanism for these operations. Done means a clear recommendation for implementing both operations, or a concrete specification clarification if the rules do not answer the question.
Written by the indexing model from the issue text.
Description
I would like to compute $f(x) := xi$, $g(y) := y - 1$ where $i$ is an imaginary number, $x$ is float and $y$ is uint, using array-api. However, I am not sure what is the best way to implement it. Following the type promotion rules
def f(x: xp.array) -> xp.array:
return x * xp.array(1j, dtype=xp.complex64 if x.dtype == xp.float32 else xp.complex128)
def g(x: xp.array) -> xp.array:
return x - xp.array(1, dtype=xp.int16 if x.dtype == xp.uint8 else xp.int32 if x.dtype == xp.uint16 else xp.int64)
This seems too redundant. What is the proper way to do this?
- 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
-
bug Maintenance Narrative Content
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
-
essnmx good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
[Feature] 奇物选择添加优先级 Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Giskard-AI/giskard-oss#2840 · 1 comment ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Openarea: repo bug perceived difficulty: 2
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
yeti-platform/yeti#1380 ·