Cell: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
Miraheze>Adám Brudzewsky
No edit summary
Miraheze>Adám Brudzewsky
mNo edit summary
Line 4: Line 4:
</div>
</div>
Interactive k-cell explorer — hover over various elements!
Interactive k-cell explorer — hover over various elements!
<div>
</div>
In the APL [[array model]] and in particular [[leading axis theory]], a '''cell''' of an array is a [[subarray]] which is formed by selecting a single [[Index#Index along an axis|index]] along some number of leading [[Axis|axes]] and the whole of each trailing axis. Cells are classified by their [[rank]], which may be between 0 ([[scalar]]s) and the array's rank (in which case the cell must be the entire array). Cells with rank <source lang=apl inline>k</source> are called '''k-cells''' of an array. A [[major cell]] is a cell whose rank is one less than the entire array, or a 0-cell of a [[scalar]].
In the APL [[array model]] and in particular [[leading axis theory]], a '''cell''' of an array is a [[subarray]] which is formed by selecting a single [[Index#Index along an axis|index]] along some number of leading [[Axis|axes]] and the whole of each trailing axis. Cells are classified by their [[rank]], which may be between 0 ([[scalar]]s) and the array's rank (in which case the cell must be the entire array). Cells with rank <source lang=apl inline>k</source> are called '''k-cells''' of an array. A [[major cell]] is a cell whose rank is one less than the entire array, or a 0-cell of a [[scalar]].



Revision as of 14:47, 11 November 2019

Interactive k-cell explorer — hover over various elements!

In the APL array model and in particular leading axis theory, a cell of an array is a subarray which is formed by selecting a single index along some number of leading axes and the whole of each trailing axis. Cells are classified by their rank, which may be between 0 (scalars) and the array's rank (in which case the cell must be the entire array). Cells with rank k are called k-cells of an array. A major cell is a cell whose rank is one less than the entire array, or a 0-cell of a scalar.

Leading and trailing axes

The k-cells of an array with rank r share the last k axes with that array, and collapse the first r-k axes by choosing a single index along each of them. Using bracket indexing this can be written

A[3;2; ; ; ]    ⍝ 3-cell of a rank-5 array

while Squad indexing allows a cell to be selected without knowing the argument's rank.

3 2⌷A           ⍝ (r-2)-cell of a rank-r array

Template:APL programming language