Skip to content

Commit 96e40ad

Browse files
authored
Remove axisN eyword arguments from linalg.diag and linalg.trace (#241)
1 parent 27bdfbe commit 96e40ad

File tree

1 file changed

+8
-26
lines changed

1 file changed

+8
-26
lines changed

spec/extensions/linear_algebra_functions.md

+8-26
Original file line numberDiff line numberDiff line change
@@ -140,23 +140,15 @@ Returns the determinant of a square matrix (or stack of square matrices) `x`.
140140
- if `x` is a two-dimensional array, a zero-dimensional array containing the determinant; otherwise, a non-zero dimensional array containing the determinant for each square matrix. The returned array must have the same data type as `x`.
141141

142142
(function-linalg-diagonal)=
143-
### linalg.diagonal(x, /, *, axis1=0, axis2=1, offset=0)
143+
### linalg.diagonal(x, /, *, offset=0)
144144

145-
Returns the specified diagonals. If `x` has more than two dimensions, then the axes (dimensions) specified by `axis1` and `axis2` are used to determine the two-dimensional sub-arrays from which to return diagonals.
145+
Returns the specified diagonals of a matrix (or a stack of matrices) `x`.
146146

147147
#### Parameters
148148

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

151-
- input array. Must have at least `2` dimensions.
152-
153-
- **axis1**: _int_
154-
155-
- first axis (dimension) with respect to which to take diagonal. Default: `0`.
156-
157-
- **axis2**: _int_
158-
159-
- second axis (dimension) with respect to which to take diagonal. Default: `1`.
151+
- input array having shape `(..., M, N)` and whose innermost two dimensions form `MxN` matrices.
160152

161153
- **offset**: _int_
162154

@@ -172,7 +164,7 @@ Returns the specified diagonals. If `x` has more than two dimensions, then the a
172164

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

175-
- if `x` is a two-dimensional array, a one-dimensional array containing the diagonal; otherwise, a multi-dimensional array containing the diagonals and whose shape is determined by removing `axis1` and `axis2` and appending a dimension equal to the size of the resulting diagonals. The returned array must have the same data type as `x`.
167+
- 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`.
176168

177169
(function-linalg-eig)=
178170
### linalg.eig()
@@ -593,23 +585,15 @@ Computes the singular values of a matrix (or a stack of matrices) `x`.
593585
- 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`.
594586

595587
(function-linalg-trace)=
596-
### linalg.trace(x, /, *, axis1=0, axis2=1, offset=0)
588+
### linalg.trace(x, /, *, offset=0)
597589

598-
Returns the sum along the specified diagonals. If `x` has more than two dimensions, then the axes (dimensions) specified by `axis1` and `axis2` are used to determine the two-dimensional sub-arrays for which to compute the trace.
590+
Returns the sum along the specified diagonals of a matrix (or a stack of matrices) `x`.
599591

600592
#### Parameters
601593

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

604-
- input array. Must have at least `2` dimensions. Should have a numeric data type.
605-
606-
- **axis1**: _int_
607-
608-
- first axis (dimension) with respect to which to compute the trace. Default: `0`.
609-
610-
- **axis2**: _int_
611-
612-
- second axis (dimension) with respect to which to compute the trace. Default: `1`.
596+
- input array having shape `(..., M, N)` and whose innermost two dimensions form `MxN` matrices. Should have a numeric data type.
613597

614598
- **offset**: _int_
615599

@@ -625,9 +609,7 @@ Returns the sum along the specified diagonals. If `x` has more than two dimensio
625609

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

628-
- if `x` is a two-dimensional array, the returned array must be a zero-dimensional array containing the trace; otherwise, the returned array must be a multi-dimensional array containing the traces.
629-
630-
The shape of a multi-dimensional output array is determined by removing `axis1` and `axis2` and storing the traces in the last array dimension. For example, if `x` has rank `k` and shape `(I, J, K, ..., L, M, N)` and `axis1=-2` and `axis1=-1`, then a multi-dimensional output array has rank `k-2` and shape `(I, J, K, ..., L)` where
612+
- an array containing the traces and whose shape is determined by removing the last two dimensions and storing the traces in the last array dimension. For example, if `x` has rank `k` and shape `(I, J, K, ..., L, M, N)`, then an output array has rank `k-2` and shape `(I, J, K, ..., L)` where
631613

632614
```text
633615
out[i, j, k, ..., l] = trace(a[i, j, k, ..., l, :, :])

0 commit comments

Comments
 (0)