Skip to content

Use count_nonzero instead of sum for boolean arrays #8913

Open
@jachymb

Description

@jachymb

Hello,
I was computing some correlations while I noticed that I can easily make an implementation significantly faster than coffcoef by replacing sum() with count_nonzero(). Therefore, I think whenever sum() is called on a boolean array, it should use count_nonzero or such instead of addition.

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