Indexing: Difference between revisions

Jump to navigation Jump to search
8 bytes removed ,  05:35, 9 June 2020
(Created page with ":''This page is about the concept of extracting items from an array. See Index for the concept of a location in an array. See Bracket indexing, Index (function), [...")
 
Line 21: Line 21:
</source>
</source>


=== Relationship to [[leading axis theory]] ===
=== Relationship to leading axis theory ===


For implementations that support [[leading axis theory]], it is common to select [[cell|cells]] or especially [[major cell|major cells]] of an array. In these implementations, [[Index (function)|Squad]] can be used with short left [[argument]] so that the omitted trailing axes can be selected as-is. A few implementations also support [[Select]], the primitive dedicated to selecting major cells.
For implementations that support [[leading axis theory]], it is common to select [[cell|cells]] or especially [[major cell|major cells]] of an array. In these implementations, [[Index (function)|Squad]] can be used with short left [[argument]] so that the omitted trailing axes can be selected as-is. A few implementations also support [[Select]], the primitive dedicated to selecting major cells.
Line 32: Line 32:
</source>
</source>


=== [[Replicate]] as a special case ===
=== Replicate as a special case ===


Various forms of [[Replicate]] can be used to select one or more indices over a single axis. <source lang=apl inline>X/Y</source> applies to the last axis, <source lang=apl inline>X⌿Y</source> to the first, and <source lang=apl inline>X/[K]Y</source> applies to the K-th axis. All the other axes are kept intact. The main difference from other indexing primitives is that X does not specify the indices; instead, it specifies how many copies of the corresponding indices to include in the result.
Various forms of [[Replicate]] can be used to select one or more indices over a single axis. <source lang=apl inline>X/Y</source> applies to the last axis, <source lang=apl inline>X⌿Y</source> to the first, and <source lang=apl inline>X/[K]Y</source> applies to the K-th axis. All the other axes are kept intact. The main difference from other indexing primitives is that X does not specify the indices; instead, it specifies how many copies of the corresponding indices to include in the result.

Navigation menu