slogdet

paddle.linalg. slogdet ( x, name=None ) [source]

Calculates the sign and natural logarithm of the absolute value of a square matrix’s or batches square matrices’ determinant. The determinant can be computed with sign * exp (logabsdet)

Supports input of float, double

Note that for matrices that have zero determinant, this returns (0, -inf)

Parameters

x (Tensor) – the batch of matrices of size \((*, n, n)\) where math:* is one or more batch dimensions.

Returns

y (Tensor), A tensor containing the sign of the determinant and the natural logarithm of the absolute value of determinant, respectively.

Examples

import paddle

x =  paddle.randn([3,3,3])

A = paddle.linalg.slogdet(x)

print(A)

# [[ 1.        ,  1.        , -1.        ],
# [-0.98610914, -0.43010661, -0.10872950]])