bitwise shift of booleans?

Open
#997 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
numpy
Domain
documentation

Research direction

Start with the linked Bitwise operators section of the Array API specification and compare the boolean shift behavior described there with the NumPy and JAX behavior cited in the issue. Done means resolving whether boolean shifts belong in the standard and documenting the intended output dtype.

Written by the indexing model from the issue text.

Description

Narrative Content

The standard does not define bitwise_left_shift or bitwise_right_shift for booleans, but does (strictly speaking) define the operators for boolean input in "Bitwise operators".

Bitwise operators should be defined for arrays having integer and boolean data types.

This may be an oversight, but if not, what should the output dtype be? bool per typical type promotion, or something else? NumPy produces int8, and JAX prefers int32.

Crossref jax-ml/jax#35537.

Dominant language
Python
Stars
281
Forks
52
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from data-apis/array-api

All issues in data-apis/array-api

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.