From 9296b5ab905d22ebf6f0057b4889c882505ccc37 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Wed, 17 Dec 2025 14:20:59 +0530 Subject: [PATCH] Update RectDiagonal broadcasting to accept 2-element size --- src/FillArrays.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/FillArrays.jl b/src/FillArrays.jl index c8c04172..29dfc746 100644 --- a/src/FillArrays.jl +++ b/src/FillArrays.jl @@ -534,8 +534,9 @@ end # Also, maybe this should reuse the broadcasting behavior of the parent, # once AbstractFill types implement their own BroadcastStyle BroadcastStyle(::Type{<:RectDiagonal}) = LinearAlgebra.StructuredMatrixStyle{RectDiagonal}() -LinearAlgebra.structured_broadcast_alloc(bc, ::Type{<:RectDiagonal}, ::Type{ElType}, n) where {ElType} = - RectDiagonal(Array{ElType}(undef, n), axes(bc)) +function LinearAlgebra.structured_broadcast_alloc(bc, ::Type{<:RectDiagonal}, ::Type{ElType}, n) where {ElType} + RectDiagonal(Array{ElType}(undef, minimum(n)), axes(bc)) +end @inline LinearAlgebra.fzero(S::RectDiagonal{T}) where {T} = zero(T) #########