cond#

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

Compute the condition number of x.

Parameters:
  • x (Union[Array, NativeArray]) – An array with more than one dimension.

  • p (Optional[Union[int, float, str]], default: None) – The order of the norm of the matrix (see ivy.norm() for details).

  • 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 – the condition number of the input.

Examples

>>> x = ivy.array([[1., 2.],
...                [3., 4.]])
>>> ivy.cond(x)
ivy.array(14.933034)
>>> x = ivy.array([[1., 2.],
...                     [3., 4.]])
>>> ivy.cond(x, p=ivy.inf)
    ivy.array(21.0)
Array.cond(self, /, *, p=None)[source]#

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

Return type:

Array

Examples

>>> x = ivy.array([[1,2], [3,4]])
>>> x.cond()
ivy.array(14.933034373659268)
>>> x = ivy.array([[1,2], [3,4]])
>>> x.cond(p=ivy.inf)
ivy.array(21.0)
Container.cond(self, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, p=None)[source]#

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

Parameters:
  • self (Container) – container with input arrays.

  • p (Optional[Union[int, float, Container]], default: None) – order of the norm of the matrix (see ivy.norm).

Returns:

ret – container including array corresponding to condition number of input array

Examples

>>> x = ivy.array([[1,2], [3,4]])
>>> c = ivy.Container(a=x)
>>> c.cond()
ivy.array(14.933034)
>>> x = ivy.array([[1,2], [3,4]])
>>> c = ivy.Container(a=x)
>>> c.cond(p=1)
ivy.array(21.0)

With ivy.Container input:

>>> a = ivy.Container(x=ivy.arange(2 * 3).reshape((2, 3)),
...                   y=ivy.arange(2 * 3).reshape((2, 3)))
>>> a.cond()
{
    x: ivy.array(14.933034),
    y: ivy.array(14.933034)
}