Returns the outer product of two vectors.
Given two vectors, [a0, a1, ..., aM] and [b0, b1, ..., bN], the outer product becomes:
[[a0*b0 a0*b1 ... a0*bN ]
[a1*b0 .
[ ... .
[aM*b0 aM*bN ]]
Parameters: | a : array_like, shaped (M,)
b : array_like, shaped (N,)
|
---|---|
Returns: | out : ndarray, shaped (M, N)
|
Notes
The outer product of vectors is a special case of the Kronecker product.
Examples
>>> x = np.array(['a', 'b', 'c'], dtype=object)
>>> np.outer(x, [1, 2, 3])
array([[a, aa, aaa],
[b, bb, bbb],
[c, cc, ccc]], dtype=object)