lgamma#

ivy.lgamma(x, /, *, out=None)[source]#

Compute the natural logarithm of the absolute value of the gamma function on x.

Parameters:
  • x (Union[Array, NativeArray]) – input array. Should have a floating-point data type.

  • out (Optional[Array], default: None) – optional output array, for writing the result to. It must have a shape that the inputs broadcast to.

Return type:

Array

Returns:

ret – an array containing the natural log of Gamma(x) of each element in x. The returned array must have a floating-point data type determined by type-promotion.

Examples

>>> x = ivy.array([1.6, 2.6, 3.5])
>>> y = x.lgamma()
>>> print(y)
ivy.array([-0.11259177,  0.3574118 ,  1.20097363])
>>> x = ivy.array([1., 2., 3. ])
>>> y = x.lgamma()
>>> print(y)
ivy.array([0. ,0. ,0.69314718])
>>> x = ivy.array([4.5, -4, -5.6])
>>> x.lgamma(out = x)
>>> print(x)
ivy.array([2.45373654, inf, -4.6477685 ])
Array.lgamma(self, *, out=None)[source]#

ivy.Array instance method variant of ivy.lgamma. This method simply wraps the function, and so the docstring for ivy.lgamma also applies to this method with minimal changes.

Parameters:
  • self (Array) – input array. Should have a real-valued floating-point data type.

  • out (Optional[Array], default: None) – optional output array, for writing the result to. It must have a shape that the inputs broadcast to.

Return type:

Array

Returns:

ret – an array containing the evaluated result for each element in self. The returned array must have a real-valued floating-point data type determined by type-promotion.

Examples

>>> x = ivy.array([1., 2., 3.])
>>> y = x.lgamma()
>>> print(y)
ivy.array([0., 0., 0.69314718])
>>> x = ivy.array([4.5, -4, -5.6])
>>> x.lgamma(out = x)
>>> print(x)
ivy.array([2.45373654, inf, -4.6477685 ])
Container.lgamma(self, /, *, out=None)[source]#
Return type:

Container