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: Jay Foad
Subject: Re: Five-dimensional transpose results in incorrect shape
Date: Wed, 11 Mar 2020 12:17:18 +0000

On Tue, 10 Mar 2020 at 18:37, Kacper Gutowski <address@hidden> wrote:
>
> 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.

Right, and defining it this way round means that multiple argument
axes can map to the same result axis, so you can extract the diagonal
of a matrix with 0 0⍉MAT.

Jay.



reply via email to

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