Skip to contents

Element-wise natural logarithm of the absolute value of the gamma function. You can also use lgamma().

Usage

nv_lgamma(x)

Arguments

x

(arrayish)
One input. Can be any numeric data type: a float keeps its own, and an integer one is converted to the default float data type (see default_dtypes()). An R value materializes at its default data type and is converted in the same way.

Value

(arrayish)
Has the input's shape, and its data type – or the default float data type (see default_dtypes()) where the input was an integer one.

See also

prim_lgamma() for the underlying primitive.

Examples

# the input's data type carries through
x <- nv_array(c(0.5, 1, 2, 5))
lgamma(x)
#> AnvlArray
#>  5.7236e-01
#>  4.7684e-07
#>  0.0000e+00
#>  3.1781e+00
#> [ CPUf32{4} ] 

# an R value materializes at its default data type
nv_lgamma(2)
#> AnvlArray
#>  0
#> [ CPUf32{} ]