Axis: Difference between revisions

Jump to navigation Jump to search
168 bytes added ,  11:07, 16 June 2020
no edit summary
m (8 revisions imported: Migrate from miraheze)
No edit summary
(One intermediate revision by one other user not shown)
Line 1: Line 1:
:''This article is about the array property. For the special syntax which modifies the behavior of a function, see [[bracket axis]]''
In the APL [[array model]], an '''axis''' is one dimension along which the [[element]]s of an array are organized. The [[rank]] of an array is the number of axes it has, and the [[shape]] is the list of their lengths. The [[index]] of a single element of an array is composed of a one index along each axis. An index [[Index#Index along an axis|along one axis]] is a single number; in this sense, axes are one-dimensional.
In the APL [[array model]], an '''axis''' is one dimension along which the [[element]]s of an array are organized. The [[rank]] of an array is the number of axes it has, and the [[shape]] is the list of their lengths. The [[index]] of a single element of an array is composed of a one index along each axis. An index [[Index#Index along an axis|along one axis]] is a single number; in this sense, axes are one-dimensional.


Line 11: Line 12:
The choice to give leading axes lower indices and trailing axes higher indices is related to the choice to put lower-order places at higher indices in the base representation functions [[Decode]] and [[Encode]]. This is known in the wider programming world as a [[wikipedia:Endianness|big-endian]] order. Because the base representation and axis ordering are in alignment, [[selection]] of an single element from an array satisfies the clean identity <source lang=apl inline>i⌷A</source> {{←→}} <source lang=apl inline>((⍴A)⊥i)⌷,A</source>. If base representation used the opposite order, both of Decode's arguments would need to be reversed.
The choice to give leading axes lower indices and trailing axes higher indices is related to the choice to put lower-order places at higher indices in the base representation functions [[Decode]] and [[Encode]]. This is known in the wider programming world as a [[wikipedia:Endianness|big-endian]] order. Because the base representation and axis ordering are in alignment, [[selection]] of an single element from an array satisfies the clean identity <source lang=apl inline>i⌷A</source> {{←→}} <source lang=apl inline>((⍴A)⊥i)⌷,A</source>. If base representation used the opposite order, both of Decode's arguments would need to be reversed.


{{APL features}}
{{APL features}}[[Category:Array characteristics]]

Navigation menu