Index: Difference between revisions

Jump to navigation Jump to search
270 bytes added ,  05:32, 9 June 2020
m
Miraheze>Marshall
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
:''This page is about the array theory concept. See [[Indexing]], [[Indices]], [[Index Generator]], and [[Index of]] for operations named after indices.''
:''This page is about the array theory concept. See [[Indexing]], [[Indices]], [[Index Generator]], [[Index of]], and [[Interval Index]] for operations named after indices.''


In the APL [[array model]], an '''index''' is a [[vector]] of integers which indicates an [[element]] of an array. The term "index" may also refer to a [[scalar]] index ''along an [[axis]]'', or (particularly in [[leading axis theory]]) the index of a [[cell]]. Indices are subject to [[index origin]] in languages which have such a concept.
In the APL [[array model]], an '''index''' is a [[vector]] of integers which indicates an [[element]] of an array. The term "index" may also refer to a [[scalar]] index ''along an [[axis]]'', or (particularly in [[leading axis theory]]) the index of a [[cell]]. Indices are subject to [[index origin]] in languages which have such a concept.
Line 32: Line 32:
== Index along an axis ==
== Index along an axis ==


Each of the values in an index corresponds to one [[axis]] of the indexed array. When considered in isolation, one of these values (a [[scalar]] number) is called an index ''along'' the corresponding axis. Selecting from the array using this index produces an array whose [[rank]] is one smaller than the initial array (and it cannot be done to a [[scalar]], as there are no axes along which to index). This array is sometimes called a "slice" or [[hyperplane]] of the array.
Each of the values in an index corresponds to one [[axis]] of the indexed array. When considered in isolation, one of these values (a [[scalar]] number) is called an index ''along'' the corresponding axis. Selecting from the array using this index produces an array whose [[rank]] is one smaller than the initial array (and it cannot be done to a [[scalar]], as there are no axes along which to index). This array is sometimes called a "slice" or [[hyperplane]] of the array. Selecting on the first axis gives a [[major cell]], one kind of hyperplane.


The set of possible axes into an array as a whole is the [[wikipedia:Cartesian product|cartesian product]] of the possible indices into each axis.
The set of possible indices into an array as a whole is the [[wikipedia:Cartesian product|Cartesian product]] of the possible indices into each axis.


== Index of a cell ==
== Index of a cell ==
Line 40: Line 40:
In [[leading axis theory]] an array's [[shape]] may be split in two with leading [[Axis|axes]] forming the [[frame]] and trailing axes forming the shape of each [[cell]]. A [[vector]] of indices for the axes in the frame only selects a cell of the array. [[Squad indexing]] supports this kind of selection using a short [[simple]] left argument. Using a frame with the same length as that argument, the given indices correspond to leading axes of the right argument—the ones in the frame—and those axes are not present in the result. All the indices into a cell, corresponding to trailing axes, are implicit, and those axes are unchanged.
In [[leading axis theory]] an array's [[shape]] may be split in two with leading [[Axis|axes]] forming the [[frame]] and trailing axes forming the shape of each [[cell]]. A [[vector]] of indices for the axes in the frame only selects a cell of the array. [[Squad indexing]] supports this kind of selection using a short [[simple]] left argument. Using a frame with the same length as that argument, the given indices correspond to leading axes of the right argument—the ones in the frame—and those axes are not present in the result. All the indices into a cell, corresponding to trailing axes, are implicit, and those axes are unchanged.


{{APL programming language}}
== External links ==
 
* [https://www.sacrideo.us/apl-a-day-5-indexing-into-arrays/ Indexing into Arrays] (from [https://www.sacrideo.us/tag/apl-a-day/ APL a Day])
 
{{APL features}}[[Category:Arrays]]

Navigation menu