det#

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

Return the determinant of a square matrix (or a stack of square matrices)``x``.

Parameters:
  • x (Union[Array, NativeArray]) – input array having shape (..., M, M) and whose innermost two dimensions form square matrices. 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 – if x is a two-dimensional array, a zero-dimensional array containing the determinant; otherwise,a non-zero dimensional array containing the determinant for each square matrix. The returned array must have the same data type as x.

This function conforms to the Array API Standard. This docstring is an extension of the docstring in the standard.

Both the description and the type hints above assumes an array input for simplicity, but this function is nestable, and therefore also accepts ivy.Container instances in place of any of the arguments.

Examples

With ivy.Array input:

>>> x = ivy.array([[2.,4.],[6.,7.]])
>>> y = ivy.det(x)
>>> print(y)
ivy.array(-10.)
>>> x = ivy.array([[3.4,-0.7,0.9],[6.,-7.4,0.],[-8.5,92,7.]])
>>> y = ivy.det(x)
>>> print(y)
ivy.array(293.46997)

With ivy.NativeArray input:

>>> x = ivy.native_array([[3.4,-0.7,0.9],[6.,-7.4,0.],[-8.5,92,7.]])
>>> y = ivy.det(x)
>>> print(y)
ivy.array(293.46997)

With ivy.Container input:

>>> x = ivy.Container(a = ivy.array([[3., -1.], [-1., 3.]]) ,
...                   b = ivy.array([[2., 1.], [1., 1.]]))
>>> y = ivy.det(x)
>>> print(y)
{a:ivy.array(8.),b:ivy.array(1.)}
Array.det(self, /, *, out=None)[source]#
Return type:

Array

Examples

>>> x = ivy.array([[2.,4.],[6.,7.]])
>>> y = x.det()
>>> print(y)
ivy.array(-10.)
Container.det(self, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
Return type:

Container

Examples

>>> x = ivy.Container(a = ivy.array([[3., -1.], [-1., 3.]]) ,
...                   b = ivy.array([[2., 1.], [1., 1.]]))
>>> y = x.det()
>>> print(y)
{a:ivy.array(8.),b:ivy.array(1.)}