dask 2021.10.0

ParametersReturnsBackRef
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:

$$C[i_0, ..., i_{M-1}, j_0, ..., j_{N-1}] =op(A[i_0, ..., i_{M-1}], B[j_0, ..., j_{N-1}])$$

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

Parameters

A : array_like

First array

B : array_like

Second array

kwargs : any

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.

Returns

r : ndarray

Output array

This docstring was copied from numpy.ufunc.outer.

See Also

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.

Examples

This example is valid syntax, but we were not able to check execution
>>> 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: +SKIP
... A.shape # doctest: +SKIP (2, 3)
This example is valid syntax, but we were not able to check execution
>>> B = np.array([[1, 2, 3, 4]])  # doctest: +SKIP
... B.shape # doctest: +SKIP (1, 4)
This example is valid syntax, but we were not able to check execution
>>> C = np.multiply.outer(A, B)  # doctest: +SKIP
... 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]]]])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

dask.array.routines.outer

Local connectivity graph

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


File: /dask/array/ufunc.py#134
type: <class 'function'>
Commit: