Skip to content

Add specification for performing a batched matrix transpose on an array instance via an .mT attribute #246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 13, 2021

Conversation

kgryte
Copy link
Contributor

@kgryte kgryte commented Aug 30, 2021

This PR:

  • adds a specification for the .mT attribute for performing a batched matrix transpose on an array instance.

Background

Discussion regarding the need for an .mT attribute can be found in gh-228.

Notably, we cannot use the existing .T attribute for applying a transpose operation to a stack of matrices, as this would introduce an undesirable incompatibility in the array library ecosystem, where existing practice (see NumPy et al) is to reverse all dimensions for arrays having more than two-dimensions. Accordingly, in order to support applying a batched matrix transpose on an array instance, a new attribute is necessary.

@kgryte kgryte added the API extension Adds new functions or objects to the API. label Aug 30, 2021
@kgryte
Copy link
Contributor Author

kgryte commented Sep 13, 2021

Adding an .mT attribute has been discussed in consortium meetings (most recently on 09-02-2021). During these meetings, no objections were raised against the addition of this attribute, as .mT achieves the desirable behavior of a batched matrix transpose for arrays having more than two-dimensions.

As the .T attribute is now restricted to 2D (see gh-245), .mT extends the transpose to arrays having more than two dimensions via a batched matrix transpose without breaking backward compatibility (i.e., reversing axes).

Further, the .mT attribute is complementary to the matrix_transpose API (added in gh-248).

Merging...

@kgryte kgryte merged commit 38bbea7 into main Sep 13, 2021
@kgryte kgryte deleted the add-mt-attribute branch September 13, 2021 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API extension Adds new functions or objects to the API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant