Outer Product: Difference between revisions

Jump to navigation Jump to search
6 bytes added ,  08:34, 26 August 2023
m
(Add section about J's Table; relate OP to Cartesian product; fix a typo)
Line 137: Line 137:
In APL one can accomplish this behavior by enclosing the relevant cells of each argument before applying the outer product operation (or by successive applications of [[rank_(operator)|Rank]], e.g. <syntaxhighlight lang=apl inline>f⍤2 99⍤99 1</syntaxhighlight>). Conversely, the behavior of APL's Outer Product can be accomplished in terms of J's Table by adding the Each modifier, as in <syntaxhighlight lang=j inline>u&.>/</syntaxhighlight> or <syntaxhighlight lang=j inline>u&>/</syntaxhighlight>, depending on whether the given operand is a [[scalar function]].
In APL one can accomplish this behavior by enclosing the relevant cells of each argument before applying the outer product operation (or by successive applications of [[rank_(operator)|Rank]], e.g. <syntaxhighlight lang=apl inline>f⍤2 99⍤99 1</syntaxhighlight>). Conversely, the behavior of APL's Outer Product can be accomplished in terms of J's Table by adding the Each modifier, as in <syntaxhighlight lang=j inline>u&.>/</syntaxhighlight> or <syntaxhighlight lang=j inline>u&>/</syntaxhighlight>, depending on whether the given operand is a [[scalar function]].


The Cartesian pairing behavior of J's Table results from each <syntaxhighlight lang=j inline>"(lu, _)</syntaxhighlight> cell-pairing being processed by <syntaxhighlight lang=j inline>u</syntaxhighlight>, which applies its own ranks to divide up the argument into cells.
The Cartesian pairing behavior of J's Table results from each <syntaxhighlight lang=j inline>"(lu, _)</syntaxhighlight> cell-pairing being processed by <syntaxhighlight lang=j inline>u</syntaxhighlight>, which applies its own ranks to divide up the right argument into cells.


However, it does not allow for creating a Cartesian pairing involving cells of the left argument specified with negative left rank L (except trivially, in cases in which Table's application has no effect, e.g. <syntaxhighlight lang=j inline>u"2 _"_ 1/</syntaxhighlight>). This is because negative assigned rank in J is encoded as infinite rank; in J's terminology, negative rank is "internal rank" only.
However, it does not allow for creating a Cartesian pairing involving cells of the left argument specified with negative left rank L (except trivially, in cases in which Table's application has no effect, e.g. <syntaxhighlight lang=j inline>u"2 _"_ 1/</syntaxhighlight>). This is because negative assigned rank in J is encoded as infinite rank; in J's terminology, negative rank is "internal rank" only.
trusted
83

edits

Navigation menu