I’ve been using ArrayPartition
(from RecursiveArrayTools.jl) and StaticArrays. I’m not sure if this is an expected use case, but I end up with nested ArrayPartition
s. When I then do operations on that array, the shapes of the underlying arrays are changed. Here’s an example:
julia> x = ArrayPartition(ArrayPartition(@SMatrix [1.1 1.2; 1.3 1.4]), SVector(1.2))
([1.1 1.2; 1.3 1.4], [1.2])
julia> y = 1.1 * x
([1.21, 1.43, 1.32, 1.54], [1.32])
julia> typeof(x.x[1])
ArrayPartition{Float64,Tuple{SArray{Tuple{2,2},Float64,2,4}}}
julia> typeof(y.x[1])
Array{Float64,1}
This change of the underlying shapes seems to then cause an error later on when I try to do a broadcasted operation with x
and y
:
ERROR: LoadError: conflicting broadcast rules defined
Broadcast.BroadcastStyle(::RecursiveArrayTools.ArrayPartitionStyle{Base.Broadcast.ArrayConflict}, ::RecursiveArrayTools.ArrayPartitionStyle{Base.Broadcast.DefaultArrayStyle{1}}) = RecursiveArrayTools.ArrayPartitionStyle{Base.Broadcast.ArrayConflict}()
Broadcast.BroadcastStyle(::RecursiveArrayTools.ArrayPartitionStyle{Base.Broadcast.DefaultArrayStyle{1}}, ::RecursiveArrayTools.ArrayPartitionStyle{Base.Broadcast.ArrayConflict}) = RecursiveArrayTools.ArrayPartitionStyle{Base.Broadcast.Unknown}()
One of these should be undefined (and thus return Broadcast.Unknown).
Am I just wrong to be nesting ArrayPartition
s, or is this a bug?
Thank you!