SubArray of subArray now returns subArray of original parent #3538
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
left-hand subArrays always return the parent Array with a new dimensions/strides (copy parameter == false).
When the parent Array however already was an subArray, an internal copy was executed and a subArray on the internal copy was returned. All updates performed on this left-hand subArray were lost.
Reason:
the subArray calculation assumes that the parent array is linear. If not, a copy is created before starting the calculation.
For left-hand subArrays, a copy is not allowed because we would no longer write into the parent data buffer. It is also not necessary for parent subArrays since the original parent array still is linear (although the parent subArray is not).
Solution:
The linear check is changed so that we now verify the original parent array on linearity. In case of non-linear a copy is still performed when the copy parameter is true, otherwise an AF_ERROR is thrown.
Description
Additional information about the PR answering following questions:
-->
Fixes: [BUG] Elementwise value assignment silently fails after in-place array downsize using
rows()
#3534Changes to Users
No changes
Checklist