Skip to contents

Element-wise population count (number of set bits).

Usage

prim_popcnt(operand)

Arguments

operand

(arrayish)
Arrayish value of data type integer or unsigned integer.

Value

arrayish
Has the same shape and data type as the input. It is ambiguous if the input is ambiguous.

Implemented Rules

  • stablehlo

  • reverse

StableHLO

Lowers to stablehlo::hlo_popcnt().

See also

Examples

x <- nv_array(c(7L, 3L, 15L))
prim_popcnt(x)
#> AnvlArray
#>  3
#>  2
#>  4
#> [ CPUi32{3} ]