Proposal to standardize element-wise elementary mathematical functions
See original GitHub issueBased on the analysis of array library APIs, we know that evaluating element-wise elementary mathematical functions is both universally implemented and commonly used. Accordingly, this issue proposes to standardize the following elementary mathematical functions:
Special Functions
- abs (absolute)
- exp
- log
- sqrt
Rounding
- ceil
- floor
- trunc
- round
Trigonometry
- sin
- cos
- tan
- asin (arcsin)
- acos (arccos)
- atan (arctan)
- sinh
- cosh
- tanh
- asinh (arcsinh)
- acosh (arccosh)
- atanh (arctanh)
Criterion
- Commonly implemented across array libraries.
- Commonly used by array library consumers.
- Operates on a single array (e.g., this criterion excludes
atan2
).
Questions
- Naming conventions? The above is biased toward C naming conventions (e.g.,
atan
vsarctan
). - Are there any APIs listed above which should not be standardized?
- Are there elementary mathematical functions not listed above which should be standardized? Preferably, any additions should be supported by usage data.
- Should the standard mandate a minimum precision to ensure portability? (e.g., JavaScript’s lack of minimum precision specification offers a cautionary tale)
Issue Analytics
- State:
- Created 3 years ago
- Comments:40 (38 by maintainers)
Top Results From Across the Web
Proposal to standardize element-wise arithmetic operations · Issue ...
Based on the analysis of array library APIs, we know that performing element-wise arithmetic operations is both universally implemented and commonly used.
Read more >Proposal for a Standardization of Mathematical ... - HAL-Inria
Proposal for a standardization of mathematical functions ... This paper proposes a standard for elementary functions, detailed in.
Read more >Mathematical Operations and Elementary Functions
Mathematical Operations and Elementary Functions. Julia provides a complete collection of basic arithmetic and bitwise operators across all of its numeric ...
Read more >Named Tensor Notation - OpenReview
This work proposes a mathematical notation for named tensors and a fully ... Any function from a scalar to a scalar can be...
Read more >The Standard Library — Julia Language 0.3.0-prerelease 文档
Alternatively, using Module will import all exported Module functions into the current namespace. By convention, function names ending with an exclamation point ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We can also keep the keyword-only requirements. In which case, the universal signature would be
We should update that doc page, but I’ll just note that JAX has a more recent improved syntax for indexing assignment:
x.at[idx].set(y)
vsx[idx] = y
One advantage of the non-mutating version is that JAX can have reliable assigning arithmetic on array slices with
x.at[idx].add(y)
(x[idx] += y
doesn’t work ifx[idx]
returns a copy).A disadvantage is that doing this sort thing inside a loop is almost always a bad idea unless you have a JIT compiler, because every indexing assignment operation makes a full copy. So the naive translation of an efficient Python loop that fills out an array row by row would now make a copy in each step. Instead, you’d have to rewrite that loop to use something like
concatenate
instead (which in my experience is already about as efficient as using indexing assignment).