Skip to content

Change the return name from v to vh in linalg.svd #218

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 1 commit into from
Jul 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions spec/extensions/linear_algebra_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ Returns the eigenvalues and eigenvectors of a symmetric matrix (or a stack of sy
- **out**: _Tuple\[ <array> ]_

- a namedtuple (`eigenvalues`, `eigenvectors`) whose

- first element must have the field name `eigenvalues` and must be an array consisting of computed eigenvalues. The array containing the eigenvalues must have shape `(..., M)`.
- second element have have the field name `eigenvectors` and must be an array where the columns of the inner most matrices contain the computed eigenvectors. The array containing the eigenvectors must have shape `(..., M, M)`.

Expand Down Expand Up @@ -291,7 +291,7 @@ Returns the least-squares solution to a linear matrix equation `Ax = b`.
- **out**: _Tuple\[ <array>, <array>, <array>, <array> ]_

- a namedtuple `(x, residuals, rank, s)` whose

- first element must have the field name `x` and must be an array containing the least-squares solution for each `MxN` matrix in `x1`. The array containing the solutions must have shape `(N, K)` and must have a floating-point data type determined by {ref}`type-promotion`.
- second element must have the field name `residuals` and must be an array containing the sum of squares residuals (i.e., the squared Euclidean 2-norm for each column in `b - Ax`). The array containing the residuals must have shape `(K,)` and must have a floating-point data type determined by {ref}`type-promotion`.
- third element must have the field name `rank` and must be an array containing the effective rank of each `MxN` matrix. The array containing the ranks must have shape `shape(x1)[:-2]` and must have an integer data type.
Expand All @@ -300,7 +300,7 @@ Returns the least-squares solution to a linear matrix equation `Ax = b`.
(function-linalg-matmul)=
### linalg.matmul(x1, x2, /)

Alias for {ref}`function-matmul`.
Alias for {ref}`function-matmul`.

(function-linalg-matrix_power)=
### linalg.matrix_power(x, n, /)
Expand Down Expand Up @@ -458,7 +458,7 @@ Computes the (Moore-Penrose) pseudo-inverse of a matrix (or a stack of square ma
- input array having shape `(..., M, N)` and whose innermost two dimensions form `MxN` matrices. Should have a floating-point data type.

- **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. 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`.

#### Returns
Expand Down Expand Up @@ -519,10 +519,10 @@ The purpose of this function is to calculate the determinant more accurately whe
- **out**: _Tuple\[ <array>, <array> ]_

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

- first element must have the field name `sign` and must be an array containing a number representing the sign of the determinant for each square matrix.
- second element must have the field name `logabsdet` and 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`.
Expand Down Expand Up @@ -551,7 +551,7 @@ Returns the solution to the system of linear equations represented by the well-d
(function-linalg-svd)=
### linalg.svd(x, /, *, full_matrices=True)

Computes the singular value decomposition `A = USV` of a matrix (or a stack of matrices) `x`.
Computes the singular value decomposition `A = USVh` of a matrix (or a stack of matrices) `x`.

#### Parameters

Expand All @@ -561,17 +561,17 @@ Computes the singular value decomposition `A = USV` of a matrix (or a stack of m

- **full_matrices**: _bool_

- If `True`, compute full-sized `u` and `v`, such that `u` has shape `(..., M, M)` and `v` has shape `(..., N, N)`. If `False`, compute on the leading `K` singular vectors, such that `u` has shape `(..., M, K)` and `v` has shape `(..., K, N)` and where `K = min(M, N)`. Default: `True`.
- If `True`, compute full-sized `u` and `vh`, such that `u` has shape `(..., M, M)` and `vh` has shape `(..., N, N)`. If `False`, compute on the leading `K` singular vectors, such that `u` has shape `(..., M, K)` and `vh` has shape `(..., K, N)` and where `K = min(M, N)`. Default: `True`.

#### Returns

- **out**: _Union\[ <array>, Tuple\[ <array>, ... ] ]_

- a namedtuple `(u, s, v)` whose
- a namedtuple `(u, s, vh)` whose

- first element must have the field name `u` and must be an array whose shape depends on the value of `full_matrices` and contain unitary array(s) (i.e., the left singular vectors). The left singular vectors must be stored as columns. If `full_matrices` is `True`, the array must have shape `(..., M, M)`. If `full_matrices` is `False`, the array must have shape `(..., M, K)`, where `K = min(M, N)`. The first `x.ndim-2` dimensions must have the same shape as those of the input `x`.
- second element must have the field name `s` and must be an array with shape `(..., K)` that contains the vector(s) of singular values of length `K`. For each vector, the singular values must be sorted in descending order by magnitude, such that `s[..., 0]` is the largest value, `s[..., 1]` is the second largest value, et cetera. The first `x.ndim-2` dimensions must have the same shape as those of the input `x`.
- third element must have the field name `v` and must be an array whose shape depends on the value of `full_matrices` and contain unitary array(s) (i.e., the right singular vectors). The right singular vectors must be stored as rows (i.e., the array is the adjoint). If `full_matrices` is `True`, the array must have shape `(..., N, N)`. If `full_matrices` is `False`, the array must have shape `(..., K, N)` where `K = min(M, N)`. The first `x.ndim-2` dimensions must have the same shape as those of the input `x`.
- third element must have the field name `vh` and must be an array whose shape depends on the value of `full_matrices` and contain unitary array(s) (i.e., the right singular vectors). The right singular vectors must be stored as rows (i.e., the array is the adjoint). If `full_matrices` is `True`, the array must have shape `(..., N, N)`. If `full_matrices` is `False`, the array must have shape `(..., K, N)` where `K = min(M, N)`. The first `x.ndim-2` dimensions must have the same shape as those of the input `x`.

Each returned array must have the same floating-point data type as `x`.

Expand Down Expand Up @@ -648,4 +648,4 @@ Alias for {ref}`function-transpose`.
(function-linalg-vecdot)=
### linalg.vecdot(x1, x2, /, *, axis=None)

Alias for {ref}`function-vecdot`.
Alias for {ref}`function-vecdot`.