Skip to contents

Element-wise polygamma function: the (n+1)-th derivative of the log-gamma function. Both n and x must have the same shape; n typically holds non-negative integer values.

Usage

prim_polygamma(n, x)

Arguments

n, x

(arrayish)
Two inputs of the same shape. Can be any float data type. n and x must have the same data type. An R value among them assumes the data type of the others when it is in its data type category, and its default data type when none of them has one.

Value

(arrayish)
Has the inputs' shape and data type.

Implemented Rules

  • stablehlo

  • reverse

StableHLO

Lowers to hlo_polygamma(), an op of the CHLO dialect, a higher-level companion to StableHLO that is lowered to it during compilation. See chlo.polygamma.

See also

Examples

# both operands are floats, as the primitive requires
n <- nv_array(c(1, 1, 2))
x <- nv_array(c(0.5, 1, 2))
prim_polygamma(n, x)
#> AnvlArray
#>   4.9348
#>   1.6449
#>  -0.4041
#> [ CPUf32{3} ]