Skip to content

Conversation

@huangxu96
Copy link
Contributor

@huangxu96 huangxu96 commented Sep 22, 2021

PR types

New features

PR changes

APIs

Describe

Cherry-pick :#34992

Add new API : paddle.linalg.det & paddle.linalg.slogdet

API Alias:paddle.det& paddle.slogdet

Example:

paddle.det():

Calculates the determinant value of a square matrix or batches of square matrices.

Supports the input of float, double

Args:
x (Tensor): input (Tensor): the input matrix of size (n, n) or the batch of matrices of size
(*, n, n) where * is one or more batch dimensions.

Returns:
y (Tensor): the determinant value of a square matrix or batches of square matrices.

Example: 
    .. code-block:: python

    import paddle

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

    A = paddle.det(x)

    print(A)

    # [ 0.02547996,  2.52317095, -6.15900707])

paddle.slogdet():

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 the input of float, double

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

Args:
x (Tensor): the batch of matrices of size : math:(*, 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.

Example:
.. code-block:: python

    import paddle

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

    A = paddle.slogdet(x)

    print(A)

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

@paddle-bot-old
Copy link

paddle-bot-old bot commented Sep 22, 2021

✅ This PR's description meets the template requirements!
Please wait for other CI results.

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@huangxu96 huangxu96 changed the title Det &Slogdet (#34992) [Cherry-pick]Det &Slogdet (#34992) Sep 22, 2021
Add new API : paddle.linalg.det & paddle.linalg.slogdet

API Alias:paddle.det& paddle.slogdet
@paddle-bot-old
Copy link

Sorry to inform you that 3bfc3d3's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@huangxu96
Copy link
Contributor Author

Merged in #36083

@huangxu96 huangxu96 closed this Jan 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant