Reduce: Difference between revisions

Jump to navigation Jump to search
6 bytes added ,  19:04, 26 June 2023
m
fix typo
Tags: Mobile edit Mobile web edit
m (fix typo)
Tags: Mobile edit Mobile web edit
Line 7: Line 7:
In [[nested array model]], Reduce has a strong property that the reduced axis is removed from the [[shape]] of the argument, which forces it to [[enclose]] each non-[[simple]] result in the returned array. It can be modeled as <syntaxhighlight lang=apl inline>f¨/</syntaxhighlight> in the leading axis model.
In [[nested array model]], Reduce has a strong property that the reduced axis is removed from the [[shape]] of the argument, which forces it to [[enclose]] each non-[[simple]] result in the returned array. It can be modeled as <syntaxhighlight lang=apl inline>f¨/</syntaxhighlight> in the leading axis model.


In [[leading axis model]], Reduce only has the first-axis form, and it reduces the [[major cell|major cells]] of the entire array, not the individual elements. It does not enclose the result either. It can be modeled as <syntaxhighlight lang=apl inline>↑f⌿⊂⍣¯1⊢x</syntaxhighlight> in the nested array model. Reduction over an axis other than the first is performed via the [[Rank (operator)|Rank operator]], which [[mix|mixes]] the results into a flat array.
In [[leading axis model]], Reduce only has the first-axis form, and it reduces the [[major cell|major cells]] of the entire array, not the individual elements. It does not enclose the result either. It can be modeled as <syntaxhighlight lang=apl inline>↑⍤(f⌿)⍤(⊂⍤¯1)</syntaxhighlight> in the nested array model. Reduction over an axis other than the first is performed via the [[Rank (operator)|Rank operator]], which [[mix|mixes]] the results into a flat array.


== Examples ==
== Examples ==
trusted
83

edits

Navigation menu