parse_assignment_indices(indices, shape)
The aim of this is to convert the indices to a standardised form so that it is easier to ascertain which chunks are touched by the indices.
This function is intended to be called by setitem_array
.
A slice object that is decreasing (i.e. with a negative step), is recast as an increasing slice (i.e. with a postive step. For example slice(7,3,-1)
would be cast as slice(4,8,1)
. This is to facilitate finding which blocks are touched by the index. The dimensions for which this has occured are returned by the function.
Indices to array defining the elements to be assigned.
The shape of the array.
The reformated indices that are equivalent to the input indices.
The shape implied by of the parsed indices. For instance, indices of (slice(0,2), 5, [4,1,-1])
will have shape [2,3]
.
The positions of the dimensions whose indices in the parsed_indices output are reversed slices.
Reformat the indices for assignment.
>>> parse_assignment_indices((slice(1, -1),), (8,)) ([slice(1, 7, 1)], [6], [])This example is valid syntax, but we were not able to check execution
>>> parse_assignment_indices(([1, 2, 6, 5],), (8,)) ([array([1, 2, 6, 5])], [4], [])This example is valid syntax, but we were not able to check execution
>>> parse_assignment_indices((3, slice(-1, 2, -1)), (7, 8)) ([3, slice(3, 8, 1)], [5], [1])See :
The following pages refer to to this document either explicitly or contain code examples using this.
dask.array.slicing.parse_assignment_indices
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