Skip to content

Commit 84a4804

Browse files
authored
Add element-wise comparison APIs (#28)
1 parent a24ac53 commit 84a4804

File tree

1 file changed

+144
-0
lines changed

1 file changed

+144
-0
lines changed

spec/API_specification/elementwise_functions.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,30 @@ Calculates the division for each element `x1_i` of the input array `x1` with the
316316

317317
#### Returns
318318

319+
- **out**: _<array>_
320+
321+
- an array containing the element-wise results.
322+
323+
### <a name="equal" href="#equal">#</a> equal(x1, x2, /, *, out=None)
324+
325+
Computes the truth value of `x1_i == x2_i` for each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`.
326+
327+
#### Parameters
328+
329+
- **x1**: _&lt;array&gt;_
330+
331+
- first input array.
332+
333+
- **x2**: _&lt;array&gt;_
334+
335+
- second input array. Must be compatible with `x1` (see :ref:`broadcasting`).
336+
337+
- **out**: _Optional\[ &lt;array&gt; ]_
338+
339+
- output array. If provided, the output array must be compatible with the provided input arrays (see :ref:`broadcasting`). If not provided or is `None`, an uninitialized return array, whose underlying data type is `bool`, must be created and then filled with the result of each element-wise computation. Default: `None`.
340+
341+
#### Returns
342+
319343
- **out**: _&lt;array&gt;_
320344

321345
- an array containing the element-wise results.
@@ -368,6 +392,102 @@ Rounds each element `x_i` of the input array `x` to the greatest (i.e., closest
368392

369393
- an array containing the rounded result for each element in `x`.
370394

395+
### <a name="greater" href="#greater">#</a> greater(x1, x2, /, *, out=None)
396+
397+
Computes the truth value of `x1_i > x2_i` for each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`.
398+
399+
#### Parameters
400+
401+
- **x1**: _&lt;array&gt;_
402+
403+
- first input array.
404+
405+
- **x2**: _&lt;array&gt;_
406+
407+
- second input array. Must be compatible with `x1` (see :ref:`broadcasting`).
408+
409+
- **out**: _Optional\[ &lt;array&gt; ]_
410+
411+
- output array. If provided, the output array must be compatible with the provided input arrays (see :ref:`broadcasting`). If not provided or is `None`, an uninitialized return array, whose underlying data type is `bool`, must be created and then filled with the result of each element-wise computation. Default: `None`.
412+
413+
#### Returns
414+
415+
- **out**: _&lt;array&gt;_
416+
417+
- an array containing the element-wise results.
418+
419+
### <a name="greater_equal" href="#greater_equal">#</a> greater_equal(x1, x2, /, *, out=None)
420+
421+
Computes the truth value of `x1_i >= x2_i` for each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`.
422+
423+
#### Parameters
424+
425+
- **x1**: _&lt;array&gt;_
426+
427+
- first input array.
428+
429+
- **x2**: _&lt;array&gt;_
430+
431+
- second input array. Must be compatible with `x1` (see :ref:`broadcasting`).
432+
433+
- **out**: _Optional\[ &lt;array&gt; ]_
434+
435+
- output array. If provided, the output array must be compatible with the provided input arrays (see :ref:`broadcasting`). If not provided or is `None`, an uninitialized return array, whose underlying data type is `bool`, must be created and then filled with the result of each element-wise computation. Default: `None`.
436+
437+
#### Returns
438+
439+
- **out**: _&lt;array&gt;_
440+
441+
- an array containing the element-wise results.
442+
443+
### <a name="less" href="#less">#</a> less(x1, x2, /, *, out=None)
444+
445+
Computes the truth value of `x1_i < x2_i` for each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`.
446+
447+
#### Parameters
448+
449+
- **x1**: _&lt;array&gt;_
450+
451+
- first input array.
452+
453+
- **x2**: _&lt;array&gt;_
454+
455+
- second input array. Must be compatible with `x1` (see :ref:`broadcasting`).
456+
457+
- **out**: _Optional\[ &lt;array&gt; ]_
458+
459+
- output array. If provided, the output array must be compatible with the provided input arrays (see :ref:`broadcasting`). If not provided or is `None`, an uninitialized return array, whose underlying data type is `bool`, must be created and then filled with the result of each element-wise computation. Default: `None`.
460+
461+
#### Returns
462+
463+
- **out**: _&lt;array&gt;_
464+
465+
- an array containing the element-wise results.
466+
467+
### <a name="less_equal" href="#less_equal">#</a> less_equal(x1, x2, /, *, out=None)
468+
469+
Computes the truth value of `x1_i <= x2_i` for each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`.
470+
471+
#### Parameters
472+
473+
- **x1**: _&lt;array&gt;_
474+
475+
- first input array.
476+
477+
- **x2**: _&lt;array&gt;_
478+
479+
- second input array. Must be compatible with `x1` (see :ref:`broadcasting`).
480+
481+
- **out**: _Optional\[ &lt;array&gt; ]_
482+
483+
- output array. If provided, the output array must be compatible with the provided input arrays (see :ref:`broadcasting`). If not provided or is `None`, an uninitialized return array, whose underlying data type is `bool`, must be created and then filled with the result of each element-wise computation. Default: `None`.
484+
485+
#### Returns
486+
487+
- **out**: _&lt;array&gt;_
488+
489+
- an array containing the element-wise results.
490+
371491
### <a name="log" href="#log">#</a> log(x, /, *, out=None)
372492

373493
Calculates an implementation-dependent approximation to the natural (base `e`) logarithm, having domain `[0, +infinity]` and codomain `[-infinity, +infinity]`, for each element `x_i` of the input array `x`.
@@ -512,6 +632,30 @@ Calculates the product for each element `x1_i` of the input array `x1` with the
512632

513633
- an array containing the element-wise products.
514634

635+
### <a name="not_equal" href="#not_equal">#</a> not_equal(x1, x2, /, *, out=None)
636+
637+
Computes the truth value of `x1_i != x2_i` for each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`.
638+
639+
#### Parameters
640+
641+
- **x1**: _&lt;array&gt;_
642+
643+
- first input array.
644+
645+
- **x2**: _&lt;array&gt;_
646+
647+
- second input array. Must be compatible with `x1` (see :ref:`broadcasting`).
648+
649+
- **out**: _Optional\[ &lt;array&gt; ]_
650+
651+
- output array. If provided, the output array must be compatible with the provided input arrays (see :ref:`broadcasting`). If not provided or is `None`, an uninitialized return array, whose underlying data type is `bool`, must be created and then filled with the result of each element-wise computation. Default: `None`.
652+
653+
#### Returns
654+
655+
- **out**: _&lt;array&gt;_
656+
657+
- an array containing the element-wise results.
658+
515659
### <a name="round" href="#round">#</a> round(x, /, *, out=None)
516660

517661
Rounds each element `x_i` of the input array `x` to the nearest integer-valued number.

0 commit comments

Comments
 (0)