Skip to content

xp.arange(n) in __truediv__ is not array-api compatible #5

Open

Description

@connoraird

Description

Lines such as the below in corr are not array-api compatible as xp.arange(n) produces an integer dtype which is not allowed in __truediv__.

a = (2 * xp.arange(n) + 1) / (4 * xp.pi) * cl

Error message

TypeError: Only floating-point dtypes are allowed in __truediv__

Activity

  1. paddyroddy commented on Jan 22, 2026

    @paddyroddy
    Member

    I just ran into this too

  2. ntessore commented on May 5, 2026

    @ntessore
    Collaborator

    Can change to (2.0 * xp.arange(n) + 1) / (4 * xp.pi) * cl?

    Or is xp.arange(n, float) a generic idiom to get a floating point range?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions