Skip to content

fix: permute_axes bug#1596

Merged
akern40 merged 4 commits into
rust-ndarray:masterfrom
akern40:fix-permute-axes
Jun 6, 2026
Merged

fix: permute_axes bug#1596
akern40 merged 4 commits into
rust-ndarray:masterfrom
akern40:fix-permute-axes

Conversation

@akern40
Copy link
Copy Markdown
Collaborator

@akern40 akern40 commented Jun 6, 2026

As pointed out in #1589, permute_axes had a bug. This uses a simple algorithm to fix it; explanations for this algorithm are all over the internet, it's nothing fancy. I did take the opportunity to introduce proptest, which I'd like to make more use of over time.

Down the line, it would be good to change the argument to permute_axes to be something like T: Permutation. Right now, permute_axes just has an assertion that the input is a real permutation. I'd call that a classic example of this library opting for asserts when we could be using better typing. But I think that will be easier / better to introduce after the core rework.

Closes #1859

akern40 added 2 commits June 6, 2026 15:38
As pointed out in rust-ndarray#1589, permute_axes had a bug. This uses a simple algorithm to fix it; explanations for this algorithm are all over the internet, it's nothing fancy. I did take the opportunity to introduce proptest, which I'd like to make more use of over time.

Down the line, it would be good to change the argument to `permute_axes` to be something like `T: Permutation`. Right now, `permute_axes` just has an assertion that the input is a real permutation. I'd call that a classic example of this library opting for asserts when we could be using better typing. But I think that will be easier / better to introduce after the core rework.
@akern40 akern40 force-pushed the fix-permute-axes branch from 253d1d9 to d311c16 Compare June 6, 2026 19:39
@akern40 akern40 enabled auto-merge (squash) June 6, 2026 19:42
@akern40 akern40 merged commit 794f670 into rust-ndarray:master Jun 6, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant