Skip to content

Commit 5216142

Browse files
authored
Add bitwise elementwise specifications (#54)
1 parent 424fb71 commit 5216142

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed

spec/API_specification/elementwise_functions.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,122 @@ Calculates an implementation-dependent approximation to the inverse hyperbolic t
278278

279279
- an array containing the inverse hyperbolic tangent of each element in `x`.
280280

281+
### <a name="bitwise_and" href="#bitwise_and">#</a> bitwise_and(x1, x2, /)
282+
283+
Computes the bitwise AND of the underlying binary representation of each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`.
284+
285+
#### Parameters
286+
287+
- **x1**: _&lt;array&gt;_
288+
289+
- first input array. Must have an integer or boolean data type.
290+
291+
- **x2**: _&lt;array&gt;_
292+
293+
- second input array. Must be compatible with `x1` (see :ref:`broadcasting`). Must have an integer or boolean data type.
294+
295+
#### Returns
296+
297+
- **out**: _&lt;array&gt;_
298+
299+
- an array containing the element-wise results.
300+
301+
### <a name="bitwise_left_shift" href="#bitwise_left_shift">#</a> bitwise_left_shift(x1, x2, /)
302+
303+
Shifts the bits of each element `x1_i` of the input array `x1` to the left by appending `x2_i` (i.e., the respective element in the input array `x2`) zeros to the right of `x1_i`.
304+
305+
#### Parameters
306+
307+
- **x1**: _&lt;array&gt;_
308+
309+
- first input array. Must have an integer data type.
310+
311+
- **x2**: _&lt;array&gt;_
312+
313+
- second input array. Must be compatible with `x1` (see :ref:`broadcasting`). Must have an integer or boolean data type. Each element must be greater than or equal to `0`.
314+
315+
#### Returns
316+
317+
- **out**: _&lt;array&gt;_
318+
319+
- an array containing the element-wise results.
320+
321+
### <a name="bitwise_invert" href="#bitwise_invert">#</a> bitwise_invert(x, /)
322+
323+
Inverts (flips) each bit for each element `x_i` of the input array `x`.
324+
325+
#### Parameters
326+
327+
- **x**: _&lt;array&gt;_
328+
329+
- input array. Must have an integer or boolean data type.
330+
331+
#### Returns
332+
333+
- **out**: _&lt;array&gt;_
334+
335+
- an array containing the element-wise results. Must have the same data type as `x`.
336+
337+
### <a name="bitwise_or" href="#bitwise_or">#</a> bitwise_or(x1, x2, /)
338+
339+
Computes the bitwise OR of the underlying binary representation of each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`.
340+
341+
#### Parameters
342+
343+
- **x1**: _&lt;array&gt;_
344+
345+
- first input array. Must have an integer or boolean data type.
346+
347+
- **x2**: _&lt;array&gt;_
348+
349+
- second input array. Must be compatible with `x1` (see :ref:`broadcasting`). Must have an integer or boolean data type.
350+
351+
#### Returns
352+
353+
- **out**: _&lt;array&gt;_
354+
355+
- an array containing the element-wise results.
356+
357+
### <a name="bitwise_right_shift" href="#bitwise_right_shift">#</a> bitwise_right_shift(x1, x2, /)
358+
359+
Shifts the bits of each element `x1_i` of the input array `x1` to the right according to the respective element `x2_i` of the input array `x2`.
360+
361+
#### Parameters
362+
363+
- **x1**: _&lt;array&gt;_
364+
365+
- first input array. Must have an integer data type.
366+
367+
- **x2**: _&lt;array&gt;_
368+
369+
- second input array. Must be compatible with `x1` (see :ref:`broadcasting`). Must have an integer or boolean data type. Each element must be greater than or equal to `0`.
370+
371+
#### Returns
372+
373+
- **out**: _&lt;array&gt;_
374+
375+
- an array containing the element-wise results.
376+
377+
### <a name="bitwise_xor" href="#bitwise_xor">#</a> bitwise_xor(x1, x2, /)
378+
379+
Computes the bitwise XOR of the underlying binary representation of each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`.
380+
381+
#### Parameters
382+
383+
- **x1**: _&lt;array&gt;_
384+
385+
- first input array. Must have an integer or boolean data type.
386+
387+
- **x2**: _&lt;array&gt;_
388+
389+
- second input array. Must be compatible with `x1` (see :ref:`broadcasting`). Must have an integer or boolean data type.
390+
391+
#### Returns
392+
393+
- **out**: _&lt;array&gt;_
394+
395+
- an array containing the element-wise results.
396+
281397
### <a name="ceil" href="#ceil">#</a> ceil(x, /)
282398

283399
Rounds each element `x_i` of the input array `x` to the smallest (i.e., closest to `-infinity`) integer-valued number that is not less than `x_i`.

0 commit comments

Comments
 (0)