FillArrays.jl
FillArrays.jl copied to clipboard
Unary broadcasting `identity.(a)` and `ComplexF64.(a)` don't preserve `Ones` and `Zeros`
For example:
julia> identity.(Zeros(2))
2-element Fill{Float64}, with entries equal to 0.0
julia> identity.(Ones(2))
2-element Fill{Float64}, with entries equal to 1.0
julia> ComplexF64.(Zeros(2))
2-element Fill{ComplexF64}, with entries equal to 0.0 + 0.0im
julia> ComplexF64.(Ones(2))
2-element Fill{ComplexF64}, with entries equal to 1.0 + 0.0im
julia> complex.(Zeros(2))
2-element Fill{ComplexF64}, with entries equal to 0.0 + 0.0im
julia> complex.(Ones(2))
2-element Fill{ComplexF64}, with entries equal to 1.0 + 0.0im
julia> pkgversion(FillArrays)
v"1.13.0"
julia> versioninfo()
Julia Version 1.11.6
Commit 9615af0f269 (2025-07-09 12:58 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: macOS (arm64-apple-darwin24.0.0)
CPU: 10 × Apple M1 Max
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
Environment:
JULIA_EDITOR = code
This would be fixed by https://github.com/JuliaArrays/FillArrays.jl/pull/385, but we may specialize some cases until that's merged.
I think specializing only makes sense if there is some need downstream, otherwise just wait til the general fix
I think specializing only makes sense if there is some need downstream, otherwise just wait til the general fix
I have some use cases where this would be helpful but I can work around it for the time being.