xlogy#

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

Compute x*log(y) element-wise so that the result is 0 if x = 0.

Parameters:
  • x (Union[Array, NativeArray]) – First input array.

  • y (Union[Array, NativeArray]) – Second input array.

  • out (Optional[Array], default: None) – Alternate output array in which to place the result. The default is None.

Return type:

bool

Returns:

ret – The next representable values of x1 in the direction of x2.

Examples

>>> x = ivy.zeros(3)
>>> y = ivy.array([-1.0, 0.0, 1.0])
>>> ivy.xlogy(x, y)
ivy.array([0.0, 0.0, 0.0])
>>> x = ivy.array([1.0, 2.0, 3.0])
>>> y = ivy.array([3.0, 2.0, 1.0])
>>> ivy.xlogy(x, y)
ivy.array([1.0986, 1.3863, 0.0000])
Array.xlogy(self, y, /, *, out=None)[source]#

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

Parameters:
  • self (Array) – First input array.

  • y (Array) – Second input array.

  • out (Optional[Array], default: None) – Alternate output array in which to place the result. The default is None.

Return type:

Array

Returns:

ret – The next representable values of x1 in the direction of x2.

Examples

>>> x = ivy.zeros(3)
>>> y = ivy.array([-1.0, 0.0, 1.0])
>>> x.xlogy(y)
ivy.array([0.0, 0.0, 0.0])
>>> x = ivy.array([1.0, 2.0, 3.0])
>>> y = ivy.array([3.0, 2.0, 1.0])
>>> x.xlogy(y)
ivy.array([1.0986, 1.3863, 0.0000])
Container.xlogy(self, y, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#

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

Parameters:
  • self (Container) – Input container containing first input array.

  • y (Container) – Input container containing second input array.

  • key_chains (Optional[Union[List[str], Dict[str, str], Container]], default: None) – The key-chains to apply or not apply the method to. Default is None.

  • to_apply (Union[bool, Container], default: True) – If True, the method will be applied to key_chains, otherwise key_chains will be skipped. Default is True.

  • prune_unapplied (Union[bool, Container], default: False) – Whether to prune key_chains for which the function was not applied. Default is False.

  • map_sequences (Union[bool, Container], default: False) – Whether to also map method to sequences (lists, tuples). Default is False.

  • out (Optional[Container], default: None) – Alternate output array in which to place the result. The default is None.

Return type:

Container

Returns:

ret – container including the next representable values of input container’s arrays, element-wise

Examples

>>> x = ivy.Container(a=ivy.zeros(3)),        ...                         b=ivy.array([1.0, 2.0, 3.0]))
>>> y = ivy.Container(a=ivy.array([-1.0, 0.0, 1.0]),        ...                         b=ivy.array([3.0, 2.0, 1.0]))
>>> x.xlogy(y)
{
    a: ivy.array([0.0, 0.0, 0.0]),
    b: ivy.array([1.0986, 1.3863, 0.0000])
}