Skip to content

gufunc to test for all elements equal along axis #8513

@mattharrigan

Description

@mattharrigan

This is a follow up to this discussion. In certain use cases very large performance gains can be obtained with a gufunc of signature (i),(i)-.() to check if all elements along that dimension are equal. For large arrays which have any early non equal element, its dramatically faster (1000x) than the current alternative. For large arrays which are all equal, its ~10% faster due to eliminating the intermediate boolean array. For tiny arrays its much faster due to a single function call instead of at least two, but its debatable how relevant speed is for tiny problems.

Initial code is here. It includes other functions in this same family, such as all or any, and eq, ne, lt, le, gt, ge, for multiple dtypes.

On this discussion thread, there we no +1 or negative responses. I'm not sure what that means.

Assuming the functionality is desired for inclusion in numpy, then I would like advice on where this code should go.

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