Skip to content

Commit d57a1f8

Browse files
authored
Rename (and move) transpose to permute_dims (#247)
* Rename (and move) `transpose` to `permute` * Remove specification for `linalg.transpose` * Rename function to `permute_dims`, make `axes` argument required, and update reference
1 parent 25e24ca commit d57a1f8

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

spec/API_specification/array_object.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ Transpose of the array.
274274
The array instance must be two-dimensional. If the array instance is not two-dimensional, an error should be raised.
275275

276276
```{note}
277-
Limiting the transpose to two-dimensional arrays (matrices) deviates from the NumPy et al practice of reversing all axes for arrays having more than two-dimensions. This is intentional, as reversing all axes was found to be problematic (e.g., conflicting with the mathematical definition of a transpose which is limited to matrices; not operating on batches of matrices; et cetera). In order to reverse all axes, one is recommended to use the functional `permute` interface found in this specification.
277+
Limiting the transpose to two-dimensional arrays (matrices) deviates from the NumPy et al practice of reversing all axes for arrays having more than two-dimensions. This is intentional, as reversing all axes was found to be problematic (e.g., conflicting with the mathematical definition of a transpose which is limited to matrices; not operating on batches of matrices; et cetera). In order to reverse all axes, one is recommended to use the functional `permute_dims` interface found in this specification.
278278
```
279279

280280
#### Returns

spec/API_specification/manipulation_functions.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,27 @@ Reverses the order of elements in an array along the given axis. The shape of th
8080
8181
- an output array having the same data type and shape as `x` and whose elements, relative to `x`, are reordered.
8282
83+
(function-permute-dims)=
84+
### permute_dims(x, /, axes)
85+
86+
Permutes the axes (dimensions) of an array `x`.
87+
88+
#### Parameters
89+
90+
- **x**: _<array>_
91+
92+
- input array.
93+
94+
- **axes**: _Tuple\[ int, ... ]_
95+
96+
- tuple containing a permutation of `(0, 1, ..., N-1)` where `N` is the number of axes (dimensions) of `x`.
97+
98+
#### Returns
99+
100+
- **out**: _<array>_
101+
102+
- an array containing the axes permutation. The returned array must have the same data type as `x`.
103+
83104
(function-reshape)=
84105
### reshape(x, /, shape)
85106

0 commit comments

Comments
 (0)