diff --git a/src/structuredbroadcast.jl b/src/structuredbroadcast.jl index 9a4d55fd..2c1e7bfa 100644 --- a/src/structuredbroadcast.jl +++ b/src/structuredbroadcast.jl @@ -194,6 +194,7 @@ isvalidstructbc(dest::Bidiagonal, bc::Broadcasted{StructuredMatrixStyle{Bidiagon @inbounds Broadcast._broadcast_getindex(bc, b) end +Broadcast.newindex(A, b::BandIndex) = Broadcast.newindex(A, _cartinds(b)) function Broadcast.newindex(A::StructuredMatrix, b::BandIndex) # we use the fact that a StructuredMatrix is square, # and we apply newindex to both the axes at once to obtain the result diff --git a/test/structuredbroadcast.jl b/test/structuredbroadcast.jl index 71494aed..5b5cc0cd 100644 --- a/test/structuredbroadcast.jl +++ b/test/structuredbroadcast.jl @@ -376,4 +376,9 @@ end end end +@testset "newindex with BandIndex" begin + ind = Broadcast.newindex(rand(2,2),LinearAlgebra.BandIndex(0,1)) + @test ind == CartesianIndex(1,1) +end + end