Skip to content

Commit 9893373

Browse files
authored
Add specification for computing the pseudo-inverse (linalg: pinv) (#118)
* Add pinv specification * Fix statement on broadcasting * Fix type annotation * Rename keyword argument and drop scaling factor * Update copy * Rename keyword argument * Fix argument name * Update dtype requirements * Fix missing period * Update copy * Update copy * Update dtype requirements * Update copy * Move API to submodule
1 parent 059e4fe commit 9893373

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

spec/API_specification/linear_algebra_functions.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,26 @@ Computes the outer product of two vectors `x1` and `x2`.
272272

273273
- a two-dimensional array containing the outer product and whose shape is `(N, M)`. The returned array must have a data type determined by {ref}`type-promotion`.
274274

275-
(function-pinv)=
276-
### pinv()
275+
(function-linalg-pinv)=
276+
### linalg.pinv(x, /, *, rtol=None)
277277

278-
TODO
278+
Computes the (Moore-Penrose) pseudo-inverse of a matrix (or a stack of square matrices) `x`.
279+
280+
#### Parameters
281+
282+
- **x**: _<array>_
283+
284+
- input array having shape `(..., M, N)` and whose innermost two dimensions form `MxN` matrices. Should have a floating-point data type.
285+
286+
- **rtol**: _Optional\[ Union\[ float, <array> ] ]_
287+
288+
- relative tolerance for small singular values. Singular values less than or equal to `rtol * largest_singular_value` are set to zero. If a `float`, the value is equivalent to a zero-dimensional array having a floating-point data type determined by {ref}`type-promotion` (as applied to `x`) and must be broadcast against each matrix. If an `array`, must have a floating-point data type and must be compatible with `shape(x)[:-2]` (see {ref}`broadcasting`). If `None`, the default value is `max(M, N) * eps`, where `eps` must be the machine epsilon associated with the floating-point data type determined by {ref}`type-promotion` (as applied to `x`). Default: `None`.
289+
290+
#### Returns
291+
292+
- **out**: _<array>_
293+
294+
- an array containing the pseudo-inverses. The returned array must have a floating-point data type determined by {ref}`type-promotion` and must have shape `(..., N, M)` (i.e., must have the same shape as `x`, except the innermost two dimensions must be transposed).
279295

280296
(function-qr)=
281297
### qr()

0 commit comments

Comments
 (0)