Outer Product

, or Table is a monadic operator, which will produce a dyadic function when applied with a dyadic function. Outer product applies the operand function on each element of the left array with each element of the right array. It can be described as a shortcut for constructing nested for loops.

Syntax
Outer Product differs from all other monadic operators, which are written as a single glyph, with the operand on the left. For historical reasons, the outer product operator is a bi-glyph denoted as, and its appears on the right. This special notation is derived from the  notation of inner product: The result of an inner product is an array with rank two less than the sum of the argument ranks. The result of an outer product, on the other hand, is always an array of rank equal to the sum of the argument ranks. This follows from the fact that the reduction operation, which collapses two dimensions in an inner product, is not used in the outer product. The notation for outer product reflects this by canonically using a small circle as the first symbol. Thus, the ordinary outer product is written as. This syntactical inconsistency is resolved in J and BQN, where the outer product operator, called Table, and denoted  and   respectively, has the usual operator syntax.

Model
Outer Product can be modeled as.

Applications
Outer product is useful for solving problems that intuitively require a polynomial time algorithm. This may also indicate that such an algorithm is not the fastest solution.

For example, suppose we want to find duplicated elements in an non-nested array. Intuitively speaking, the easiest way to solve this problem is to compare each element of the array with all other elements, which is exactly what an outer product does. Using similar techniques, we can define a function that generates prime numbers by using an outer product of Residue. Here there are faster solutions such as the Sieve of Eratosthenes.

Documentation

 * Dyalog
 * APLX
 * J Dictionary, NuVoc
 * BQN