Skip to content

ENH: make ufunc.at faster for more cases #23176

@mattip

Description

@mattip

PR #23136 and #22889 created fast paths through ufunc.at for 1d aligned arrays with no casting. I closed issues #11156, #7998, #5922, and #8495, as mentioned in this comment and opened this to continue the discussion around additional speedups and concerns:

  • 2d and more contiguous arrays could be sped up by calling the indexed loop on the fastest dimension. Currently the indexed loop will only be called for 1d arrays
  • Add documentation on how user-defined loops can utilize this. The PR added a test that uses the experimental DType API to create a ufunc type with both a strided loop and an indexed loop. Is that the desired API?
  • https://github.com/ml31415/numpy-groupies has a number of specific ufunc-at loops. Is there more we could integrate from there? @nschloe thoughts?
  • Are there still cases where bincount is faster than ufunc.add.at?
  • Feature request: Incremental bincount and axis argument #9397 asks for an axis argument to bincount. ufunc.at does not support the axis kwarg, so I left that issue open.

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