8000 Small fixes to the linalg extension (#277) · lezcano/array-api@cd77bf9 · GitHub
[go: up one dir, main page]

Skip to content

Commit cd77bf9

Browse files
asmeurerkgryte
andauthored
Small fixes to the linalg extension (data-apis#277)
* Add a cross-reference to the linalg extension in the linear algebra section * Fix a reference to transpose() to matrix_transpose() * Remove TODO-ed linalg functions eig() and eigvals() Instead just reference that they will be added in a later version of the spec in notes. * Use a better header title for the linear algebra extension page * Fix the return type annotation for svdvals The annotation was based on a previous version where the return type was polymorphic. * Fix the type hints for vector_norm() * Remove comment Co-authored-by: Athan <kgryte@gmail.com>
1 parent 43edaa2 commit cd77bf9

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

spec/extensions/linear_algebra_functions.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Linear Algebra Functions
1+
(linear-algebra-extension)=
2+
# Linear Algebra Extension
23

34
> Array API specification for linear algebra functions.
45
@@ -37,7 +38,7 @@ Accordingly, the standardization process affords the opportunity to reduce inter
3738

3839
Lastly, certain operations may be performed independent of data type, and, thus, the associated interfaces should support all data types specified in this standard. Example operations include:
3940

40-
- `transpose`: computing the transpose.
41+
- `matrix_transpose`: computing the transpose.
4142
- `diagonal`: returning the diagonal.
4243

4344
3. **Return values**: if an interface has more than one return value, the interface should return a namedtuple consisting of each value.
@@ -166,11 +167,6 @@ Returns the specified diagonals of a matrix (or a stack of matrices) `x`.
166167

167168
- an array containing the diagonals and whose shape is determined by removing the last two dimensions and appending a dimension equal to the size of the resulting diagonals. The returned array must have the same data type as `x`.
168169

169-
(function-linalg-eig)=
170-
### linalg.eig()
171-
172-
_TODO: this requires complex number support to be added to the specification._
173-
174170
(function-linalg-eigh)=
175171
### linalg.eigh(x, /)
176172

@@ -200,10 +196,10 @@ Returns the eigenvalues and eigenvectors of a symmetric matrix (or a stack of sy
200196
Eigenvalue sort order is left unspecified.
201197
```
202198

203-
(function-linalg-eigvals)=
204-
### linalg.eigvals()
205-
206-
_TODO: this requires complex number support to be added to the specification._
199+
```{note}
200+
The function `eig` will be added in a future version of the specification,
201+
as it requires complex number support.
202+
```
207203

208204
(function-linalg-eigvalsh)=
209205
### linalg.eigvalsh(x, /)
@@ -229,6 +225,11 @@ Computes the eigenvalues of a symmetric matrix (or a stack of symmetric matrices
229225
Eigenvalue sort order is left unspecified.
230226
```
231227

228+
```{note}
229+
The function `eigvals` will be added in a future version of the specification,
230+
as it requires complex number support.
231+
```
232+
232233
(function-linalg-inv)=
233234
### linalg.inv(x, /)
234235

@@ -512,7 +513,7 @@ Computes the singular values of a matrix (or a stack of matrices) `x`.
512513

513514
#### Returns
514515

515-
- **out**: _Union\[ &lt;array&gt;, Tuple\[ &lt;array&gt;, ... ] ]_
516+
- **out**: _&lt;array&gt;_
516517

517518
- 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`.
518519

@@ -570,15 +571,15 @@ Computes the vector norm of a vector (or batch of vectors) `x`.
570571
571572
- input array. Should have a floating-point data type.
572573
573-
- **axis**: _Optional\[ Union\[ int, Tuple\[ int, int ] ] ]_
574+
- **axis**: _Optional\[ Union\[ int, Tuple\[ int, ... ] ] ]_
574575
575576
- If an integer, `axis` specifies the axis (dimension) along which to compute vector norms. If an n-tuple, `axis` specifies the axes (dimensions) along which to compute batched vector norms. If `None`, the vector norm must be computed over all array values (i.e., equivalent to computing the vector norm of a flattened array). Negative indices must be supported. Default: `None`.
576577
577578
- **keepdims**: _bool_
578579
579580
- If `True`, the axes (dimensions) specified by `axis` must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see {ref}`broadcasting`). Otherwise, if `False`, the axes (dimensions) specified by `axis` must not be included in the result. Default: `False`.
580581
581-
- **ord**: _Optional\[ Union\[ int, float, Literal\[ inf, -inf ] ] ]_
582+
- **ord**: _Union\[ int, float, Literal\[ inf, -inf ] ]_
582583
583584
- order of the norm. The following mathematical norms must be supported:
584585
| ord | description |

0 commit comments

Comments
 (0)
0