Skip to content

Commit 059e4fe

Browse files
authored
Add slogdet specification (#111)
* Add slogdet spec * Add note * Update description * Reformat description and update return value type * Add article * Simplify description * Update copy * Update copy * Update dtype requirements * Update dtype requirement for returned arrays * Update copy * Update copy * Move API to submodule
1 parent 76730f1 commit 059e4fe

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

spec/API_specification/linear_algebra_functions.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,34 @@ TODO
282282

283283
TODO
284284

285-
(function-slogdet)=
286-
### slogdet()
285+
(function-linalg-slogdet)=
286+
### linalg.slogdet(x, /)
287287

288-
TODO
288+
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`.
289+
290+
```{note}
291+
292+
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.
293+
```
294+
295+
#### Parameters
296+
297+
- **x**: _<array>_
298+
299+
- input array having shape `(..., M, M)` and whose innermost two dimensions form square matrices. Should have a floating-point data type.
300+
301+
#### Returns
302+
303+
- **out**: _Tuple\[ <array>, <array> ]_
304+
305+
- a namedtuple (`sign`, `logabsdet`) whose
306+
307+
- first element must be an array containing a number representing the sign of the determinant for each square matrix.
308+
- second element must be an array containing the determinant for each square matrix.
309+
310+
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)`.
311+
312+
Each returned array must have shape `shape(x)[:-2]` and a floating-point data type determined by {ref}`type-promotion`.
289313

290314
(function-solve)=
291315
### solve()

0 commit comments

Comments
 (0)