Skip to content

ENH: Allow ufuncs to request the iterator to provide contiguous arrays #30413

Open

Description

@mhvk

Proposed new feature or change:

In #29699, a ufunc loop for sin and cos is added that, if the input array is not contiguous, makes a copy to a contiguous buffer so that the result can be calculated using a vectorized SIMD loop. This makes a lot of sense, but as discussed there, it seems a bit strange to do this in the ufunc loop when the iterator is already able to do exactly this for non-aligned data or dtype mismatches. Indeed, it has the NPY_ITER_CONTIG flag for this purpose, so it would seem to be only a matter of allowing the ufunc/array method to specific that this should be used, either by a flag of its own or perhaps more simply, by only providing the contiguous loop in an array method.

Activity

  1. changed the title [-]ENH: Allow requesting the iterator to provide contiguous arrays[/-] [+]ENH: Allow ufuncs to request the iterator to provide contiguous arrays[/+] on Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions