Leading axis agreement: Difference between revisions
Jump to navigation
Jump to search
(List languages that use it in the intro) |
m (Text replacement - "</source>" to "</syntaxhighlight>") |
||
Line 17: | Line 17: | ||
10 11 12 | 10 11 12 | ||
13 14 15 | 13 14 15 | ||
</ | </syntaxhighlight> | ||
{{Works in|[[J]]}} | {{Works in|[[J]]}} | ||
Line 31: | Line 31: | ||
10 11 12 | 10 11 12 | ||
13 14 15 | 13 14 15 | ||
</ | </syntaxhighlight> | ||
{{Works in|[[J]]}} | {{Works in|[[J]]}} | ||
Line 45: | Line 45: | ||
10 11 12 | 10 11 12 | ||
23 24 25 | 23 24 25 | ||
</ | </syntaxhighlight> | ||
{{Works in|[[J]]}} | {{Works in|[[J]]}} | ||
In this case, <source lang=j inline>x</ | In this case, <source lang=j inline>x</syntaxhighlight> has shape <source lang=j inline>2</syntaxhighlight> and <source lang=j inline>y</syntaxhighlight> has shape <source lang=j inline>2 3</syntaxhighlight>. Since the leading axes agree and the rank difference is 1, each atom (or 0-[[cell]]) of <source lang=j inline>x</syntaxhighlight> is matched with each row (or 1-cell) of <source lang=j inline>y</syntaxhighlight>, and the two rows in the result are the results of <source lang=j inline>10 + 0 1 2</syntaxhighlight> and <source lang=j inline>20 + 3 4 5</syntaxhighlight>, respectively. | ||
== Model == | == Model == | ||
Line 63: | Line 63: | ||
10 11 12 | 10 11 12 | ||
23 24 25 | 23 24 25 | ||
</ | </syntaxhighlight> | ||
{{Works in|Dyalog APL}} | {{Works in|Dyalog APL}} | ||
== Aligning axes using the Rank operator == | == Aligning axes using the Rank operator == | ||
When using the [[Rank (operator)|Rank operator]] for dyadic functions as in <source lang=apl inline>X (f⍤m n) Y</ | When using the [[Rank (operator)|Rank operator]] for dyadic functions as in <source lang=apl inline>X (f⍤m n) Y</syntaxhighlight>, the [[Frame|frames]] of <source lang=apl inline>X</syntaxhighlight> and <source lang=apl inline>Y</syntaxhighlight> are checked for conformability. Combined with leading axis agreement, the Rank operator can be used to align the [[axis|axes]] to be matched. | ||
<source lang=j> | <source lang=j> | ||
Line 90: | Line 90: | ||
53 54 | 53 54 | ||
65 66 | 65 66 | ||
</ | </syntaxhighlight> | ||
{{Works in|[[J]]}} | {{Works in|[[J]]}} | ||
[[Category:Leading axis theory]][[Category:Function characteristics]][[Category:Conformability]]{{APL features}} | [[Category:Leading axis theory]][[Category:Function characteristics]][[Category:Conformability]]{{APL features}} |