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
Copy file name to clipboardExpand all lines: spec/extensions/linear_algebra_functions.md
+12-17Lines changed: 12 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -201,7 +201,7 @@ Returns the eigenvalues and eigenvectors of a symmetric matrix (or a stack of sy
201
201
-**out**: _Tuple\[<array>]_
202
202
203
203
- a namedtuple (`eigenvalues`, `eigenvectors`) whose
204
-
204
+
205
205
- 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)`.
206
206
- 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)`.
207
207
@@ -291,7 +291,7 @@ Returns the least-squares solution to a linear matrix equation `Ax = b`.
- 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`.
296
296
- 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`.
297
297
- 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.
@@ -300,7 +300,7 @@ Returns the least-squares solution to a linear matrix equation `Ax = b`.
300
300
(function-linalg-matmul)=
301
301
### linalg.matmul(x1, x2, /)
302
302
303
-
Alias for {ref}`function-matmul`.
303
+
Alias for {ref}`function-matmul`.
304
304
305
305
(function-linalg-matrix_power)=
306
306
### linalg.matrix_power(x, n, /)
@@ -323,11 +323,6 @@ Raises a square matrix (or a stack of square matrices) `x` to an integer power `
323
323
324
324
- if `n` is equal to zero, an array containing the identity matrix for each square matrix. If `n` is less than zero, an array containing the inverse of each square matrix raised to the absolute value of `n`, provided that each square matrix is invertible. If `n` is greater than zero, an array containing the result of raising each square matrix to the power `n`. The returned array must have the same shape as `x` and a floating-point data type determined by {ref}`type-promotion`.
325
325
326
-
#### Raises
327
-
328
-
- if the innermost two dimensions of `x` are not the same size (i.e., form square matrices).
329
-
- if `n` is less than zero and a square matrix is not invertible.
330
-
331
326
(function-linalg-matrix_rank)=
332
327
### linalg.matrix_rank(x, /, *, rtol=None)
333
328
@@ -458,7 +453,7 @@ Computes the (Moore-Penrose) pseudo-inverse of a matrix (or a stack of square ma
458
453
- input array having shape `(..., M, N)` and whose innermost two dimensions form `MxN` matrices. Should have a floating-point data type.
- 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`.
463
458
464
459
#### Returns
@@ -519,10 +514,10 @@ The purpose of this function is to calculate the determinant more accurately whe
519
514
-**out**: _Tuple\[<array>, <array>]_
520
515
521
516
- a namedtuple (`sign`, `logabsdet`) whose
522
-
517
+
523
518
- 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.
524
519
- second element must have the field name `logabsdet` and must be an array containing the determinant for each square matrix.
525
-
520
+
526
521
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)`.
527
522
528
523
Each returned array must have shape `shape(x)[:-2]` and a floating-point data type determined by {ref}`type-promotion`.
@@ -551,7 +546,7 @@ Returns the solution to the system of linear equations represented by the well-d
551
546
(function-linalg-svd)=
552
547
### linalg.svd(x, /, *, full_matrices=True)
553
548
554
-
Computes the singular value decomposition `A = USV` of a matrix (or a stack of matrices) `x`.
549
+
Computes the singular value decomposition `A = USVh` of a matrix (or a stack of matrices) `x`.
555
550
556
551
#### Parameters
557
552
@@ -561,17 +556,17 @@ Computes the singular value decomposition `A = USV` of a matrix (or a stack of m
561
556
562
557
-**full_matrices**: _bool_
563
558
564
-
- 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`.
559
+
- 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`.
- 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`.
573
568
- 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`.
574
-
- 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`.
569
+
- 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`.
575
570
576
571
Each returned array must have the same floating-point data type as `x`.
577
572
@@ -648,4 +643,4 @@ Alias for {ref}`function-transpose`.
0 commit comments