Rank: Difference between revisions
Jump to navigation
Jump to search
m (Text replacement - "<source" to "<syntaxhighlight") |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
:''This page is about array rank, a number associated with every array. For numbers associated with a function specifying its argument rank, see [[function rank]]. For the operator that applies a function at a given rank, see [[Rank (operator)]].'' | :''This page is about array rank, a number associated with every array. For numbers associated with a function specifying its argument rank, see [[function rank]]. For the operator that applies a function at a given rank, see [[Rank (operator)]].'' | ||
In the APL [[array model]], the '''rank''' of an array is the number of dimensions or [[Axis|axes]] in its structure, or the length of its [[shape]]. The traditional expression for the rank of an array < | In the APL [[array model]], the '''rank''' of an [[array]] is the number of dimensions or [[Axis|axes]] in its structure, or the length of its [[shape]]. The traditional expression for the rank of an array <syntaxhighlight lang=apl inline>A</syntaxhighlight> is <syntaxhighlight lang=apl inline>⍴⍴A</syntaxhighlight>. Because this expression results in a one-element [[vector]] rather than a [[scalar]], it is idiomatic in languages with a [[Tally]] function to write <syntaxhighlight lang=apl inline>≢⍴A</syntaxhighlight> instead. | ||
Arrays are given names based on their rank: | Arrays are given names based on their rank: |
Latest revision as of 21:45, 10 September 2022
- This page is about array rank, a number associated with every array. For numbers associated with a function specifying its argument rank, see function rank. For the operator that applies a function at a given rank, see Rank (operator).
In the APL array model, the rank of an array is the number of dimensions or axes in its structure, or the length of its shape. The traditional expression for the rank of an array A
is ⍴⍴A
. Because this expression results in a one-element vector rather than a scalar, it is idiomatic in languages with a Tally function to write ≢⍴A
instead.
Arrays are given names based on their rank:
Rank | Name |
---|---|
0 | scalar |
1 | vector |
2 | matrix |
Many APLs have a maximum rank. A function that would produce an array with rank greater than this maximum typically gives a LIMIT ERROR.
External Links
APL features [edit] | |
---|---|
Built-ins | Primitives (functions, operators) ∙ Quad name |
Array model | Shape ∙ Rank ∙ Depth ∙ Bound ∙ Index (Indexing) ∙ Axis ∙ Ravel ∙ Ravel order ∙ Element ∙ Scalar ∙ Vector ∙ Matrix ∙ Simple scalar ∙ Simple array ∙ Nested array ∙ Cell ∙ Major cell ∙ Subarray ∙ Empty array ∙ Prototype |
Data types | Number (Boolean, Complex number) ∙ Character (String) ∙ Box ∙ Namespace ∙ Function array |
Concepts and paradigms | Conformability (Scalar extension, Leading axis agreement) ∙ Scalar function (Pervasion) ∙ Identity element ∙ Complex floor ∙ Array ordering (Total) ∙ Tacit programming (Function composition, Close composition) ∙ Glyph ∙ Leading axis theory ∙ Major cell search ∙ First-class function |
Errors | LIMIT ERROR ∙ RANK ERROR ∙ SYNTAX ERROR ∙ DOMAIN ERROR ∙ LENGTH ERROR ∙ INDEX ERROR ∙ VALUE ERROR ∙ EVOLUTION ERROR |