You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clarify matmul error conditions and fix linalg docs (#282)
* Fix the input description for cholesky()
* Add some additional error cases for @ and matmul
Also use more consistent variable names for the shapes in the error cases.
* Fix the output shape for qr(mode='complete').r
* Clarify what K equals in the svd and svdvals specifications
* Use consistent naming conventions
* Use consistent naming conventions
* Use consistent naming conventions
* Restore changes
Co-authored-by: Athan <[email protected]>
Copy file name to clipboardExpand all lines: spec/extensions/linear_algebra_functions.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -90,7 +90,7 @@ Whether an array library explicitly checks whether an input array is a symmetric
90
90
91
91
-**x**: _<array>_
92
92
93
-
- input array having shape `(..., M, M)` and whose innermost two dimensions form square matrices. Should have a floating-point data type.
93
+
- input array having shape `(..., M, M)` and whose innermost two dimensions form square symmetric positive-definite matrices. Should have a floating-point data type.
94
94
95
95
-**upper**: _bool_
96
96
@@ -431,7 +431,7 @@ Whether an array library explicitly checks whether an input array is a full colu
431
431
- a namedtuple `(Q, R)` whose
432
432
433
433
- first element must have the field name `Q` and must be an array whose shape depends on the value of `mode` and contain matrices with orthonormal columns. If `mode` is `'complete'`, the array must have shape `(..., M, M)`. If `mode` is `'reduced'`, the array must have shape `(..., M, K)`, where `K = min(M, N)`. The first `x.ndim-2` dimensions must have the same size as those of the input array `x`.
434
-
- second element must have the field name `R` and must be an array whose shape depends on the value of `mode` and contain upper-triangular matrices. If `mode` is `'complete'`, the array must have shape `(..., M, M)`. If `mode` is `'reduced'`, the array must have shape `(..., K, N)`, where `K = min(M, N)`. The first `x.ndim-2` dimensions must have the same size as those of the input `x`.
434
+
- second element must have the field name `R` and must be an array whose shape depends on the value of `mode` and contain upper-triangular matrices. If `mode` is `'complete'`, the array must have shape `(..., M, N)`. If `mode` is `'reduced'`, the array must have shape `(..., K, N)`, where `K = min(M, N)`. The first `x.ndim-2` dimensions must have the same size as those of the input `x`.
435
435
436
436
Each returned array must have a floating-point data type determined by {ref}`type-promotion`.
437
437
@@ -516,7 +516,7 @@ Returns a singular value decomposition A = USVh of a matrix (or a stack of matri
516
516
- a namedtuple `(U, S, Vh)` whose
517
517
518
518
- first element must have the field name `U` and must be an array whose shape depends on the value of `full_matrices` and contain matrices with orthonormal columns (i.e., the columns are left singular vectors). 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`.
519
-
- 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`.
519
+
- 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`, where `K = min(M, N)`. 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`.
520
520
- third element must have the field name `Vh` and must be an array whose shape depends on the value of `full_matrices` and contain orthonormal rows (i.e., the rows are the right singular vectors and 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`.
521
521
522
522
Each returned array must have the same floating-point data type as `x`.
@@ -536,7 +536,7 @@ Returns the singular values of a matrix (or a stack of matrices) `x`.
536
536
537
537
-**out**: _<array>_
538
538
539
-
- 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`. The returned array must have the same floating-point data type as `x`.
539
+
- an array with shape `(..., K)` that contains the vector(s) of singular values of length `K`, where `K = min(M, N)`. 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`. The returned array must have the same floating-point data type as `x`.
0 commit comments