Skip to contents

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

Usage

nv_popcnt(x)

Arguments

x

(arrayish)
One input. Can be any integer data type. An R value materializes at its default data type.

Value

(arrayish)
Has the input's shape and data type.

See also

prim_popcnt() for the underlying primitive.

Examples

# the set bits are counted, at the input's own integer data type
x <- nv_array(c(7L, 3L, 15L))
nv_popcnt(x)
#> AnvlArray
#>  3
#>  2
#>  4
#> [ CPUi32{3} ]