Outer Product: Difference between revisions

Jump to navigation Jump to search
m (remove reference to matrix multiplication, that should be for Inner Product instead)
Line 1: Line 1:
{{Built-in|Outer Product|<nowiki>∘.</nowiki>}}, or '''Table''' is a [[monadic operator]], which will produce a [[dyadic function]] when applied with a [[dyadic function]]. In APL, the outer product is a generalisation of the [https://en.wikipedia.org/wiki/Matrix_multiplication matrix product], which allows not only multiplication, but any [[dyadic function]] given. In short, outer product allows you to apply a given function on each element of the left array with each element of the right array. Basically, a shortcut for constructing nested [https://en.wikipedia.org/wiki/For_loop for loop]s.
{{Built-in|Outer Product|<nowiki>∘.</nowiki>}}, or '''Table''' is a [[monadic operator]], which will produce a [[dyadic function]] when applied with a [[dyadic function]]. In short, outer product allows you to apply a given function on each element of the left array with each element of the right array. Basically, a shortcut for constructing nested [https://en.wikipedia.org/wiki/For_loop for loop]s.


=== Syntax ===
=== Syntax ===
Line 18: Line 18:
│3 4│3 5│3 6│
│3 4│3 5│3 6│
└───┴───┴───┘
└───┴───┴───┘
      x ∘.× y ⍝ matrix multiplication
4  5  6
8 10 12
12 15 18


       ⍝ works for multi-dimensional arrays as well
       ⍝ works for multi-dimensional arrays as well