Skip to content

Add slogdet specification #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
May 12, 2021
30 changes: 27 additions & 3 deletions spec/API_specification/linear_algebra_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,34 @@ TODO

TODO

(function-slogdet)=
### slogdet()
(function-linalg-slogdet)=
### linalg.slogdet(x, /)

TODO
Returns the sign and the natural logarithm of the absolute value of the determinant of a square matrix (or a stack of square matrices) `x`.

```{note}

The purpose of this function is to calculate the determinant more accurately when the determinant is either very small or very large, as calling `det` may overflow or underflow.
```

#### Parameters

- **x**: _<array>_

- input array having shape `(..., M, M)` and whose innermost two dimensions form square matrices. Should have a floating-point data type.

#### Returns

- **out**: _Tuple\[ <array>, <array> ]_

- a namedtuple (`sign`, `logabsdet`) whose

- first element must be an array containing a number representing the sign of the determinant for each square matrix.
- second element must be an array containing the determinant for each square matrix.

For a real matrix, the sign of the determinant must be either `1`, `0`, or `-1`. If a determinant is zero, then the corresponding `sign` must be `0` and `logabsdet` must be `-infinity`. In all cases, the determinant must be equal to `sign * exp(logsabsdet)`.

Each returned array must have shape `shape(x)[:-2]` and a floating-point data type determined by {ref}`type-promotion`.

(function-solve)=
### solve()
Expand Down