- slogdet(x: array, /) Tuple[array, array] ¶
Returns the sign and the natural logarithm of the absolute value of the determinant of a square matrix (or a stack of square matrices)
The purpose of this function is to calculate the determinant more accurately when the determinant is either very small or very large, as calling
detmay overflow or underflow.
x (array) – input array having shape
(..., M, M)and whose innermost two dimensions form square matrices. Should have a floating-point data type.
out (Tuple[array, array]) – a namedtuple (
first element must have the field name
signand must be an array containing a number representing the sign of the determinant for each square matrix.
second element must have the field name
logabsdetand must be an array containing the determinant for each square matrix.
For a real matrix, the sign of the determinant must be either
Each returned array must have shape
shape(x)[:-2]and a floating-point data type determined by Type Promotion Rules.
If a determinant is zero, then the corresponding
-infinity; however, depending on the underlying algorithm, the returned result may differ. In all cases, the determinant should be equal to
sign * exp(logsabsdet)(although, again, the result may be subject to numerical precision errors).