outer(A, B, /, **kwargs)
Some inconsistencies with the Dask version may exist.
Apply the ufunc :None:None:`op`
to all pairs (a, b) with a in A
and b in B
.
Let M = A.ndim
, N = B.ndim
. Then the result, :None:None:`C`
, of op.outer(A, B)
is an array of dimension M + N such that:
For A
and B
one-dimensional, this is equivalent to:
r = empty(len(A),len(B)) for i in range(len(A)): for j in range(len(B)): r[i,j] = op(A[i], B[j]) # op = ufunc in question
First array
Second array
Arguments to pass on to the ufunc. Typically :None:None:`dtype`
or :None:None:`out`
. See ufunc
for a comprehensive overview of all available arguments.
Output array
This docstring was copied from numpy.ufunc.outer.
numpy.outer
A less powerful version of np.multiply.outer
that :None:None:`ravel`
\ s all inputs to 1D. This exists primarily for compatibility with old code.
tensordot
np.tensordot(a, b, axes=((), ()))
and np.multiply.outer(a, b)
behave same for all dimensions of a and b.
>>> np.multiply.outer([1, 2, 3], [4, 5, 6]) # doctest: +SKIP array([[ 4, 5, 6], [ 8, 10, 12], [12, 15, 18]])
A multi-dimensional example:
This example is valid syntax, but we were not able to check execution>>> A = np.array([[1, 2, 3], [4, 5, 6]]) # doctest: +SKIPThis example is valid syntax, but we were not able to check execution
... A.shape # doctest: +SKIP (2, 3)
>>> B = np.array([[1, 2, 3, 4]]) # doctest: +SKIPThis example is valid syntax, but we were not able to check execution
... B.shape # doctest: +SKIP (1, 4)
>>> C = np.multiply.outer(A, B) # doctest: +SKIPSee :
... C.shape; C # doctest: +SKIP (2, 3, 1, 4) array([[[[ 1, 2, 3, 4]], [[ 2, 4, 6, 8]], [[ 3, 6, 9, 12]]], [[[ 4, 8, 12, 16]], [[ 5, 10, 15, 20]], [[ 6, 12, 18, 24]]]])
The following pages refer to to this document either explicitly or contain code examples using this.
dask.array.routines.outer
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them