Should `LinearAlgebra.fzero` be declared public?
https://github.com/JuliaLang/julia/blob/5e4669c7403c301985f35d2c8754b184cd73ab05/stdlib/LinearAlgebra/src/structuredbroadcast.jl#L142-L151
This method is useful in general, as it allows custom types to hook into the structure-preserving broadcast mechanism without having to define their own methods for each function. As an example:
julia> using FillArrays, LinearAlgebra
julia> Diagonal(1:4) .+ Zeros(4,4)
4×4 Matrix{Float64}:
1.0 0.0 0.0 0.0
0.0 2.0 0.0 0.0
0.0 0.0 3.0 0.0
0.0 0.0 0.0 4.0
julia> LinearAlgebra.fzero(x::Zeros) = zero(eltype(x))
julia> Diagonal(1:4) .+ Zeros(4,4)
4×4 Diagonal{Float64, Vector{Float64}}:
1.0 ⋅ ⋅ ⋅
⋅ 2.0 ⋅ ⋅
⋅ ⋅ 3.0 ⋅
⋅ ⋅ ⋅ 4.0
Perhaps this could also be done through an isstructuredmatrix trait that is made public.
cc: @dlfivefifty @dkarrasch
What is meant by "declared public"? I think it should be fine if FillArrays.jl uses this now.
As in, a guarantee that this won't be removed in the next minor release
StdLib can have breaking changes in 1.x releases so there is no such thing as a "guarantee". Only Base is guaranteed to be non-breaking.
I think we should just use this in FillArrays.jl. I'm about to tag a breaking release