fromfunction(func, chunks='auto', shape=None, dtype=None, **kwargs)
This docstring was copied from numpy.fromfunction.
Some inconsistencies with the Dask version may exist.
The resulting array therefore has a value fn(x, y, z)
at coordinate (x, y, z)
.
Keywords other than :None:None:`dtype`
are passed to :None:None:`function`
.
The function is called with N parameters, where N is the rank of shape
. Each parameter represents the coordinates of the array varying along a specific axis. For example, if shape
were (2, 2)
, then the parameters would be array([[0, 0], [1, 1]])
and array([[0, 1], [0, 1]])
Shape of the output array, which also determines the shape of the coordinate arrays passed to :None:None:`function`
.
Data-type of the coordinate arrays passed to :None:None:`function`
. By default, :None:None:`dtype`
is float.
Reference object to allow the creation of arrays which are not NumPy arrays. If an array-like passed in as like
supports the __array_function__
protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.
The result of the call to :None:None:`function`
is passed back directly. Therefore the shape of fromfunction
is completely determined by :None:None:`function`
. If :None:None:`function`
returns a scalar value, the shape of fromfunction
would not match the shape
parameter.
Construct an array by executing a function over each coordinate.
>>> np.fromfunction(lambda i, j: i == j, (3, 3), dtype=int) # doctest: +SKIP array([[ True, False, False], [False, True, False], [False, False, True]])This example is valid syntax, but we were not able to check execution
>>> np.fromfunction(lambda i, j: i + j, (3, 3), dtype=int) # doctest: +SKIP array([[0, 1, 2], [1, 2, 3], [2, 3, 4]])See :
The following pages refer to to this document either explicitly or contain code examples using this.
dask.array.creation.fromfunction
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