fmin#
- ivy.fmin(x1, x2, /, *, out=None)[source]#
Compute the element-wise minimums of two arrays. Differs from ivy.minimum in the case where one of the elements is NaN. ivy.minimum returns the NaN element while ivy.fmin returns the non-NaN element.
- Parameters:
- Return type:
Union
[Array
,NativeArray
]- Returns:
ret – Array with element-wise minimums.
Examples
>>> x1 = ivy.array([2, 3, 4]) >>> x2 = ivy.array([1, 5, 2]) >>> ivy.fmin(x1, x2) ivy.array([1, 3, 2])
>>> x1 = ivy.array([ivy.nan, 0, ivy.nan]) >>> x2 = ivy.array([0, ivy.nan, ivy.nan]) >>> ivy.fmin(x1, x2) ivy.array([ 0., 0., nan])
- Array.fmin(self, x2, /, *, out=None)[source]#
ivy.Array instance method variant of ivy.fmin. This method simply wraps the function, and so the docstring for ivy.fmin also applies to this method with minimal changes.
- Parameters:
self (
Array
) – First input array.x2 (
Array
) – Second input arrayout (
Optional
[Array
], default:None
) – optional output array, for writing the result to.
- Return type:
Array
- Returns:
ret – Array with element-wise minimums.
Examples
>>> x1 = ivy.array([2, 3, 4]) >>> x2 = ivy.array([1, 5, 2]) >>> ivy.fmin(x1, x2) ivy.array([1, 3, 2])
>>> x1 = ivy.array([ivy.nan, 0, ivy.nan]) >>> x2 = ivy.array([0, ivy.nan, ivy.nan]) >>> x1.fmin(x2) ivy.array([ 0., 0., nan])
- Container.fmin(self, x2, /, *, out=None)[source]#
ivy.Container instance method variant of ivy.fmin. This method simply wraps the function, and so the docstring for ivy.fmin also applies to this method with minimal changes.
- Parameters:
self (
Container
) – container with the first input arrays.x2 (
Container
) – container with the second input arraysout (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – Container including arrays with element-wise minimums.
Examples
>>> x1 = ivy.Container(a=ivy.array([2, 3, 4]), b=ivy.array([ivy.nan, 0, ivy.nan])) >>> x2 = ivy.Container(a=ivy.array([1, 5, 2]), b=ivy.array([0, ivy.nan, ivy.nan])) >>> x1.fmin(x2) { a: ivy.array([1, 3, 2]), b: ivy.array([0., 0., nan]) }