Undocumented behavior of TRANSPOSE [message #82787] |
Thu, 17 January 2013 03:13 |
tom.grydeland
Messages: 51 Registered: September 2012
|
Member |
|
|
Hello,
I was working on MY_TRANSPOSE -- a version of TRANSPOSE that introduces trailing singleton dimensions as necessary to fulfill the requested transpositions -- and trying to ensure that my replacement function would behave like TRANSPOSE in all cases that the latter would accept, when I ran into these unspecified corner cases:
IDL> pp = randomu(43, 2,3,4,5)
IDL> help, transpose(pp, [0, 1, 3])
<Expression> FLOAT = Array[2, 3, 5]
IDL> help, transpose(pp, [3,1])
<Expression> FLOAT = Array[5, 3]
help, array_equal(transpose(pp, [0, 3]), pp[*,0,0,*])
<Expression> BYTE = 1
so while TRANSPOSE (quite sensibly) refuses to consider repeated axes, it quite happily accepts missing axes, and just picks the first index along missing axes. Is this intentional? Is it useful? Should it be disallowed, or documented?
--T
|
|
|