Support implicit expansion and array slicing in set #44
Labels
No labels
bug
duplicate
enhancement/documentation
enhancement/feature
enhancement/organization
question
rejected
upstream
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
UserCurt/mpath#44
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When performing an assignment with
set, sizes between resolved paths and value must currently match. Depending on the combination ofUniformValuesandUniformPaths, exactly which sizes matches (cell array and their contents) can differ though.This issue proposes relaxing this requirement in two ways.
Implicit expansion (broadcasting)
Allow values with singleton dimensions to expand to match the size of the target. For example, if a path resolves to be 2×3 in size while the value being assigned is only 1×3, this would be allowed as the effective size of the value would expand to match 2×3 target grid.
Values may expand to match targets, but targets should never expand to match values.
With
UniformPaths=true, expansion applies to the combined target grid. WithUniformPaths=false, expansion applies independently inside each path group. Whether the outer cell array used byUniformPaths=falsemay itself expand across input path groups remains an open question.Array slicing
Allow values to be decomposed into slices when matching the size of the target. For example, if a path resolves to be 1×3 and the user provides a 2×3 double, slicing this double into individual 2×1 slices for assignment. This would be in contrast to assigning the 2×3 double for each of the three paths.
A choice can be made for each dimension, whether it is to be sliced or repeated. For example, if a path resolves to be 1×3×4 and the user provides a 2×3×4 double, then there would be four possibilities:
With
UniformPaths=true, decompose the array relative to the combined target dimensions. WithUniformPaths=false, decompose each outer cell’s value relative to that path group’s target dimensions.When
UniformValues=true, the same array remains one complete payload.With
UniformPaths=true, decompose the array relative to the combined target dimensions. WithUniformPaths=false, decompose each outer cell’s value relative to that path group’s target dimensions. WhenUniformValues=true, the same array remains one complete payload.set#13