bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Five-dimensional transpose results in incorrect shape


From: Kacper Gutowski
Subject: Re: Five-dimensional transpose results in incorrect shape
Date: Tue, 10 Mar 2020 19:36:50 +0100

On Wed, Mar 11, 2020 at 12:57:09AM +0800, Elias Mårtenson wrote:
Now, for the problematic version:

*      ⍴ 2 4 1 0 3 ⍉ 3 4 5 6 7 ⍴ ⍳100*
┏→━━━━━━━━┓
┃6 5 3 7 4┃
┗━━━━━━━━━┛

As you can see, the numbers are all over the place. For some reason, it seems to have interpreted the left arguments to transpose as if they were:
3 2 0 4 1

They aren't just “all over the place,” if you consider it as a permutation on shape list, it's an inverse of a permutation you expected (previous three cases happened to be self-inverses!).
You expected that Z≡⍴A⍉B⍴⍳100 iff Z≡B[A] but it's actually Z[A]≡B.

      (6 5 3 7 4)[2 4 1 0 3]
3 4 5 6 7

If I read the ISO right, it seems to be correct: values in left argument correspond to axes of result and positions to axes of right argument.

-k





reply via email to

[Prev in Thread] Current Thread [Next in Thread]