Skip to content

Add specification for computing the pseudo-inverse (linalg: pinv) #118

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 15 commits into from
May 12, 2021
20 changes: 18 additions & 2 deletions spec/API_specification/linear_algebra_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,25 @@ Computes the outer product of two vectors `x1` and `x2`.
- a two-dimensional array containing the outer product and whose shape is `NxM`. The returned array must have a data type determined by {ref}`type-promotion` rules.

(function-pinv)=
### pinv()
### pinv(x, /, *, rtol=None)

TODO
Computes the (Moore-Penrose) pseudo-inverse of a matrix (or stack of square matrices) `x`.

#### Parameters

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

- input array having shape `(..., M, N)` and whose innermost two dimensions form `MxN` matrices. Must have a data type of either `float32` or `float64`.

- **rtol**: _Optional\[ Union\[ float, <array> ] ]_

- relative tolerance for small singular values. Singular values less than or equal to `rtol * largest_singular_value` are set to zero. Must be compatible with `shape(x)[:-2]` (see {ref}`broadcasting`). If a `float`, the value is equivalent to a zero-dimensional array having the same data type as `x` and is broadcast against each matrix. If `None`, the default value is `max(M, N) * eps`, where `eps` must be the machine epsilon associated with the data type of `x`. Default: `None`.

#### Returns

- **out**: _<array>_

- an array containing the pseudo-inverses. The returned array must have the same data type and must have shape `(..., N, M)` (i.e., must have the same shape as `x`, except the innermost two dimensions must be transposed).

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