Fix nested broadcasting of BlockedArray #485
Merged
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.
Fixes #295. That issue seemed to be caused by code in the generic block broadcasting logic such as
BlockArrays.jl/src/blockbroadcast.jl
Lines 121 to 129 in 90ddfa9
Broadcast.flatten
to explicitly flatten the broadcast expression in the generic block broadcast code.It appears that at some point
BlockedStyle
broadcasting expressions were being flattened in thisBroadcast.instantiate
definition:BlockArrays.jl/src/blockbroadcast.jl
Lines 199 to 202 in 90ddfa9
I have to admit I'm not sure if this is the best place to call
Broadcast.flatten
, a lot of this broadcasting code is hard to follow. The place I put it in this PR fixes #295, doesn't break other tests, and is hopefully least likely to interfere with custom implementations of block broadcasting in downstream packages.