Rank: Difference between revisions
Jump to navigation
Jump to search
Miraheze>Adám Brudzewsky No edit summary |
Miraheze>Adám Brudzewsky m (Text replacement - "<code>" to "<source lang=apl inline>") |
||
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]].'' | ||
The rank of an array is the number of dimensions in its structure, or, in APL terms, the length of its [[shape]]. The traditional expression for the rank of an array < | The rank of an array is the number of dimensions in its structure, or, in APL terms, the length of its [[shape]]. The traditional expression for the rank of an array <source lang=apl inline>A</code> is <source lang=apl inline>⍴⍴A</code>. Because this expression results in a one-element [[vector]] rather than a [[scalar]], it is idiomatic in languages with a [[Tally]] function to write <source lang=apl inline>≢⍴A</code> instead. | ||
Arrays are given names based on their rank: | Arrays are given names based on their rank: |
Revision as of 09:06, 29 October 2019
- 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.
The rank of an array is the number of dimensions in its structure, or, in APL terms, the length of its shape. The traditional expression for the rank of an array <source lang=apl inline>A is <source lang=apl inline>⍴⍴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 <source lang=apl inline>≢⍴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.